Hi I'm here again xD I would like to know how to get last player position, for example if a player die don't teleport to lobby just teleport to same position that player was before die
Try looking at the session code of EssentialsPE. On teleporting, it stores the position, allowing you to do /back to return to that point.
PHP: /** @var $level */private $level;/** @var $position */private $position;/*** @param PlayerDeathEvent $event*/public function onDeath(PlayerDeathEvent $event) { $player = $event->getPlayer(); $this->level = $player->getLevel()->getName(); $this->position = new Vector3($player->getX(), $player->getY(), $player->getZ());}/*** @param PlayerRespawnEvent $event*/public function onRespawn(PlayerRespawnEvent $event) { $player = $event->getPlayer(); if($player->getLevel() != $this->level) { $player->teleport($this->level); } $player->teleport($this->position);}
Note that you could simply store $player->getPosition() in a variable. Position contains the xyz and the level, so that the level variable would not have to be made.