Hi, I tried to make a plugin which will spawn you in default world (hub world) once you die. But when I die it spawns me in the same world. Any help? Code: <?php namespace DIErespawnCR; use pocketmine\plugin\PluginBase; use pocketmine\event\Listener; use pocketmine\event\player\PlayerRespawnEvent; use pocketmine\math\Vector3; class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getLogger()->info("DIErespawnCR Enabled!"); } public function onDisable(){ $this->getServer()->getLogger()->info("DIErespawnCR Disabled!"); } public function onRespawn(PlayerRespawnEvent $event){ $player = $event->getPlayer(); $player->teleport($player->getLevel()->getSafeSpawn()); } }
you must be meaning this PHP: <?phpnamespace DIErespawnCR;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerRespawnEvent;use pocketmine\math\Vector3;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getLogger()->info("DIErespawnCR Enabled!"); } public function onDisable(){ $this->getServer()->getLogger()->info("DIErespawnCR Disabled!"); } public function onRespawn(PlayerRespawnEvent $event){ $player = $event->getPlayer(); $player->teleport($this->getServer()->getDefaultLevel()->getSpawn()); }}
PHP: <?phpnamespace DIErespawnCR;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerRespawnEvent;use pocketmine\math\Vector3;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getLogger()->info("DIErespawnCR Enabled!"); } public function onDisable(){ $this->getServer()->getLogger()->info("DIErespawnCR Disabled!"); } public function onRespawn(PlayerRespawnEvent $event){ $player = $event->getPlayer(); $player->teleport($this->getServer()->getDefaultLevel()->getSafeSpawn()); }}
Also... Please stop making stupidly plain titles such as "Plugin"... you need to be more detailed... For example: "Plugin Teleport Spawn Error". And, one last thing... Instead of the [ code] tags... use php tags instead.