I know how but there does not appear an error If there is a mis- classed me. PHP: public function onMove(PlayerMoveEvent $event){ $player = $event->getPlayer(); $x1 = $this->plugin->getConfig()->get("x1"); $z1 = $this->plugin->getConfig()->get("z1"); $y1 = $this->plugin->getConfig()->get("y1"); $x2 = $this->plugin->getConfig()->get("x2"); $y2 = $this->plugin->getConfig()->get("y2"); $z2 = $this->plugin->getConfig()->get("z2"); for($x = $x1; $x = $x2; $x++){ for($y = $y1; $y = $y2; $y++){ for($z = $z1; $z = $z2; $z++){ if($event->getFrom()->getFloorX() === $x){ if($event->getFrom()->getFloorY() === $y){ if($event->getFrom()->getFloorZ() === $z){ $player->sendMessage("position ok"); } } } } } } }
If you are trying to find out if player is in an area use PHP: // Player pos Pos 1 Pos 2public function isInside(Vector3 $pp, Vector3 $p1, Vector3 $p2){ return ((min($p1->getX(),$p2->getX()) <= $pp->getX()) && (max($p1->getX(),$p2->getX()) >= $pp->getX()) && (min($p1->getY(),$p2->getY()) <= $pp->getY()) && (max($p1->getY(),$p2->getY()) >= $pp->getY()) && (min($p1->getZ(),$p2->getZ()) <= $pp->getZ()) && (max($p1->getZ(),$p2->getZ()) >= $pp->getZ())); }
That function will return whether the player position is inside the area marked by the 2 positions In your case, this is the code you need PHP: public function isInside(Vector3 $pp, Vector3 $p1, Vector3 $p2){return ((min($p1->getX(),$p2->getX()) <= $pp->getX()) &&(max($p1->getX(),$p2->getX()) >= $pp->getX()) &&(min($p1->getY(),$p2->getY()) <= $pp->getY()) &&(max($p1->getY(),$p2->getY()) >= $pp->getY()) &&(min($p1->getZ(),$p2->getZ()) <= $pp->getZ()) &&(max($p1->getZ(),$p2->getZ()) >= $pp->getZ()));}public function onMove(PlayerMoveEvent $event){$player = $event->getPlayer();$x1 = $this->plugin->getConfig()->get("x1");$z1 = $this->plugin->getConfig()->get("z1");$y1 = $this->plugin->getConfig()->get("y1");$x2 = $this->plugin->getConfig()->get("x2");$y2 = $this->plugin->getConfig()->get("y2");$z2 = $this->plugin->getConfig()->get("z2");if($this->isInside($player,new Vector3($x1,$y1,$z1),new Vector3($x2,$y2,$z2))) $player->sendMessage("position ok");}