diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index f4fd85481..f3c75fd72 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -766,8 +766,6 @@ abstract class Entity extends Location implements Metadatable{ $this->despawnFromAll(); if($this instanceof Player){ foreach($this->usedChunks as $index => $d){ - $X = null; - $Z = null; Level::getXZ($index, $X, $Z); $this->unloadChunk($X, $Z); } diff --git a/src/pocketmine/level/format/generic/BaseFullChunk.php b/src/pocketmine/level/format/generic/BaseFullChunk.php index 18a2fd1a6..3fa300649 100644 --- a/src/pocketmine/level/format/generic/BaseFullChunk.php +++ b/src/pocketmine/level/format/generic/BaseFullChunk.php @@ -244,12 +244,16 @@ abstract class BaseFullChunk implements FullChunk{ public function addEntity(Entity $entity){ $this->entities[$entity->getId()] = $entity; - $this->hasChanged = true; + if(!($entity instanceof Player)){ + $this->hasChanged = true; + } } public function removeEntity(Entity $entity){ unset($this->entities[$entity->getId()]); - $this->hasChanged = true; + if(!($entity instanceof Player)){ + $this->hasChanged = true; + } } public function addTile(Tile $tile){