Hello. I Have some problem with teleport to another world . I Load Level in onEnable Function at the first time Teleport its work after Finish Game i unload The Level and Load Level In this case Teleport to another World its not work ---
use that PHP: if(!$sender->getServer()->isLevelLoaded($args[0])){ if(!$sender->getServer()->loadLevel($args[0])){ $sender->sendMessage(TextFormat::RED. "Level is not loaded"); } } $sender->teleport($this->getServer()->getLevelByName($args[0])->getSpawnLocation(), 0 , 0); the world is automatically loaded
So it does teleport you, which means it works, just not as intended. What is the name of your default world, and what world name did you use in your command?
Try something like this: PHP: /** @Player $player */ $worldName = "LuckyBlock"; $player->teleport($this->getServer()->getLevelByName($worldName)->getSafeSpawn()); Of course, if you're using a command, you can make $worldName = $args[0].