So hears my issue..i am using iProtector by LDX to add a per area effect using playerMoveEvent in his plugin. I asked him if he could help out and he said yes but he is very busy, i got impatient lol I really dont understand why my code dont work. It will send the messages CORRECTLY for multiple areas but will only set the effect for the last area i make..note when i do /area it list the last area i make..well last. lol just thinking i have some sort of array issue maybe. Anywho heres the code onEnable.. PHP: $this->config = new Config($this->getDataFolder()."config.yml", Config::YAML, array());$this->areas = array(); contains =... PHP: public function contains($pos,$level) { if((min($this->pos1->getX(),$this->pos2->getX()) <= $pos->getX()) && (max($this->pos1->getX(),$this->pos2->getX()) >= $pos->getX()) && (min($this->pos1->getY(),$this->pos2->getY()) <= $pos->getY()) && (max($this->pos1->getY(),$this->pos2->getY()) >= $pos->getY()) && (min($this->pos1->getZ(),$this->pos2->getZ()) <= $pos->getZ()) && (max($this->pos1->getZ(),$this->pos2->getZ()) >= $pos->getZ()) && ($this->level == $level)) { return true; } return false; } MoveEv.. PHP: public function onMove(playerMoveEvent $event){ foreach($this->areas as $area) { $p = $event->getPlayer(); $areaName = ($area->getName()); $ID = $this->config->get("$areaName"); if($area->contains(new Vector3($p->getX(),$p->getY(),$p->getZ()),$p->getLevel()->getName() and $ID != NULL)) { $effect = Effect::getEffect($ID); $boost = $this->config->get("$areaName-Amplifier"); if(!$p->hasEffect($ID)){ $effect->setAmplifier($boost); $effect->setVisible(false); $effect->setDuration(999999); $p->addEffect($effect); //only sets the effect for the last /area i make $p->sendMessage("$ID"); //just for testing WORKS $p->sendMessage("$areaName");//just for testing WORKS $p->sendMessage("$boost");//just for testing WORKS } }else{ $p->removeAllEffects(); } }} I just write the area names in the config like so.. Code: test2: 3 test2-Amplifier: 20 test: 2 test-Amplifier: 5 arena: 20 arena-Amplifier: 5
BTW a player is a vector so no need for PHP: new Vector3($p->getX(), $p->getY(), $p->getZ()) just put your player variable
I cant remove that..its a big part of the iProtector plugin lol i could make it diffrent tho right? like $this->Areassss lol
I is :/ lol but i took them away from the sendMessage..and it wont send the message right soo wouldnt i need to put quots around it in that case?
Kinda..lol and what do you mean? im saying when sending a message as a variable it wont work unless theirs quots around it. well this time anyway. nevermind the quots i still dont understand why this is not working properly lol it is getting the information correct for as many areas as i make but will only set the effect for the last area i make
You might as well request the plugin instead... You don't know what you're doing at all... (I could make it if you want)
I still dont understand it is getting the area correctly..area name and id and amp from the config all correctly. Wouldnt i have to use iP api to get the area?