From e0e19c67effff579c2cc21bc9b4b465bc7e36212 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 9 Sep 2021 15:55:37 +0100 Subject: [PATCH] World: do not warn about leaked Player entities during world unload this raises false-positives during shutdown if players were online. The fact that the player entity leans on the World to clean up after it is slightly problematic, but I'm not sure what else to do about it for now. --- src/world/World.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/world/World.php b/src/world/World.php index d63481f2a..a1af7fcdd 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -525,12 +525,17 @@ class World implements ChunkManager{ } foreach($this->entitiesByChunk as $chunkHash => $entities){ self::getXZ($chunkHash, $chunkX, $chunkZ); - if(count($entities) !== 0){ - $this->logger->warning(count($entities) . " entities found in ungenerated chunk $chunkX $chunkZ, they won't be saved!"); - } + + $leakedEntities = 0; foreach($entities as $entity){ + if(!$entity->isFlaggedForDespawn()){ + $leakedEntities++; + } $entity->close(); } + if($leakedEntities !== 0){ + $this->logger->warning("$leakedEntities leaked entities found in ungenerated chunk $chunkX $chunkZ during unload, they won't be saved!"); + } } $this->save();