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.
This commit is contained in:
Dylan K. Taylor 2021-09-09 15:55:37 +01:00
parent 6f8261f26a
commit e0e19c67ef
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

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