Fixed players respawning in the wrong world

add() returns a Vector3 instance, not a Position instance... argh
This commit is contained in:
Dylan K. Taylor 2017-11-04 22:04:33 +00:00
parent eab7b93483
commit 20d2ef9d38

View File

@ -2682,7 +2682,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $this->getSpawn()));
$realSpawn = $ev->getRespawnPosition()->add(0.5, 0, 0.5);
$realSpawn = Position::fromObject($ev->getRespawnPosition()->add(0.5, 0, 0.5), $ev->getRespawnPosition()->getLevel());
if($realSpawn->distanceSquared($this->getSpawn()->add(0.5, 0, 0.5)) > 0.01){
$this->teleport($realSpawn); //If the destination was modified by plugins