mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Level: Fixed entities getting deleted when switching levels
So this came from a bugfix (795d6c8ddf
) which fixed a memory leak related to entities getting kill()ed on chunk unload.
HOWEVER, me2016 did NOT realize that this code is actually entirely pointless and causes unexpected behaviour.
removeEntity() is used in 2 places in the core code:
1. in Entity->close() (so close() doesn't need to be called again, obviously)
2. in Entity->switchLevel() (which then causes the entirely unexpected behaviour of close()ing the entity on level change.
Conclusion: This code is pointless. This fixes the bugfix.
This commit is contained in:
@ -2607,8 +2607,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
if($entity instanceof Player){
|
||||
unset($this->players[$entity->getId()]);
|
||||
$this->checkSleep();
|
||||
}else{
|
||||
$entity->close();
|
||||
}
|
||||
|
||||
unset($this->entities[$entity->getId()]);
|
||||
|
Reference in New Issue
Block a user