From fbb91d123d882315715fc2261a44cecce94f68a6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 31 Oct 2021 14:03:40 +0000 Subject: [PATCH] World::unregisterChunkListenerFromAll(): go through unregisterChunkListener() this ensures that everything gets cleaned up properly (e.g. player chunk listeners). --- src/world/World.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index ab7e18ce9..484b06182 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -731,14 +731,9 @@ class World implements ChunkManager{ * Unregisters a chunk listener from all chunks it is listening on in this World. */ public function unregisterChunkListenerFromAll(ChunkListener $listener) : void{ - $id = spl_object_id($listener); foreach($this->chunkListeners as $hash => $listeners){ - if(isset($listeners[$id])){ - unset($this->chunkListeners[$hash][$id]); - if(count($this->chunkListeners[$hash]) === 0){ - unset($this->chunkListeners[$hash]); - } - } + World::getXZ($hash, $chunkX, $chunkZ); + $this->unregisterChunkListener($listener, $chunkX, $chunkZ); } }