Hi, I am trying to to a player to a specific coordinates in a specific world and I am facing some problems, this is my code : PHP: case "obw go": if($sender instanceof Player) { $IslandName = $sender->getName(); if(is_dir($this->getServer()->getDataPath() . "worlds/" . $IslandName)) { $level = $sender->getServer()->getLevelByName($IslandName); $sender->teleport($level->getSafeSpawn(new Vector3(256, 67, 256))); } } The player tps perfectly to the world but not for the exact positions, can someone help? - using PMMP 3.13.0 official
this code can have 2 problems: 1.if you want to tp the player it's better to don't use getSafeSpawn() function so you can use this code for tp: $sender->teleport(new Vector3(256, 67, 256)); 2.for subcommand don't check it in case you can use this code: PHP: switch($command->getName()){ case: "obw": if($sender instanceof Player){ if($args[0]/* for subcommand*/ == "go"){ $sender->teleport(new Vector3(256, 67, 256); } }}
and in line 7 of your code: $level = $sender->getLevel(); or: $levelname = $sender->getLevel()->getName();