Faster respawn when needed

This commit is contained in:
Shoghi Cervantes 2015-05-29 10:04:26 +02:00
parent c8abbf4f2f
commit 1e2038fac5
2 changed files with 8 additions and 2 deletions

View File

@ -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();
}
}

View File

@ -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;