I need to teleport players to certain coordinates (the world is not completely needed) My code: PHP: $this->arena1 = $this->getConfig()->get("arena1"); $this->arena1 = $this->getConfig()->get("arena2"); public function tp(Player $player) { $level1 = $this->getServer()->getLevelByName($this->arena1); $level2 = $this->getServer()->getLevelByName($this->arena2); $ap1X = $this->getConfig()->get("ap1X"); $ap1Y = $this->getConfig()->get("ap1Y"); $ap1Z = $this->getConfig()->get("ap1Z"); $tpa1 = new Position($ap1X , $ap1Y , $ap1Z , 0 , 0, $level1); $ap2X = $this->getConfig()->get("ap2X"); $ap2Y = $this->getConfig()->get("ap2Y"); $ap2Z = $this->getConfig()->get("ap2Z"); $tpa1 = new Position($ap2X , $ap2Y , $ap2Z , 0 , 0 , $level1); $bp1X = $this->getConfig()->get("bp1X"); $bp1Y = $this->getConfig()->get("bp1Y"); $bp1Z = $this->getConfig()->get("bp1Z"); $tpa1 = new Position($bp1X , $bp1Y , $bp1Z , 0 , 0 , $level2); $bp2X = $this->getConfig()->get("bp2X"); $bp2Y = $this->getConfig()->get("bp2Y"); $bp2Z = $this->getConfig()->get("bp2Z"); $tpa1 = new Position($bp2X , $bp2Y , $bp2Z , 0 , 0 , $level2); if ($player == $this->ap1) $player->teleport($tpa1); if ($player == $this->ap2) $player->teleport($tpa2); if ($player == $this->bp1) $player->teleport($tpb1); if ($player == $this->bp2) $player->teleport($tpb2); } I also tried to remove pitch and yaw, but I also got an error ...
$this->arena1 = $this->getConfig()->get("arena2"); I think it should be $this->arena2 It would help if you tell us the error
easiest way to teleport a player to coordinates is vector three PHP: $player->teleport(new Vector3($x , $y , $z));