diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 6e2ad2f5d..41d7747b1 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -562,8 +562,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade public function setSkin($str, $isSlim = false){ parent::setSkin($str, $isSlim); if($this->spawned === true){ - $this->despawnFromAll(); - $this->spawnToAll(); + $this->respawnToAll(); } } diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 0923942f3..dbd9a996e 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1465,6 +1465,13 @@ abstract class Entity extends Location implements Metadatable{ return $this->id; } + public function respawnToAll(){ + foreach($this->hasSpawned as $key => $player){ + unset($this->hasSpawned[$key]); + $this->spawnTo($player); + } + } + public function spawnToAll(){ if($this->chunk === null){ return;