diff --git a/src/event/player/PlayerInteractEvent.php b/src/event/player/PlayerInteractEvent.php index f67b72d9c..b76a8226c 100644 --- a/src/event/player/PlayerInteractEvent.php +++ b/src/event/player/PlayerInteractEvent.php @@ -31,7 +31,8 @@ use pocketmine\math\Vector3; use pocketmine\player\Player; /** - * Called when a player interacts or touches a block (including air?) + * Called when a player interacts or touches a block. + * This is called for both left click (start break) and right click (use). */ class PlayerInteractEvent extends PlayerEvent implements Cancellable{ use CancellableTrait; diff --git a/src/world/World.php b/src/world/World.php index 1873e437f..8806ffef8 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -878,7 +878,7 @@ class World implements ChunkManager{ //Update entities that need update Timings::$tickEntity->startTiming(); foreach($this->updateEntities as $id => $entity){ - if($entity->isClosed() or !$entity->onUpdate($currentTick)){ + if($entity->isClosed() or $entity->isFlaggedForDespawn() or !$entity->onUpdate($currentTick)){ unset($this->updateEntities[$id]); } if($entity->isFlaggedForDespawn()){