mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Level: fixed setChunk() leaking memory when not copying tiles/entities
closes #2719
This commit is contained in:
parent
8e47a40b4c
commit
eebd90ec42
@ -2489,6 +2489,13 @@ class Level implements ChunkManager, Metadatable{
|
||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||
if($deleteEntitiesAndTiles){
|
||||
$players = $this->getChunkPlayers($chunkX, $chunkZ);
|
||||
foreach($players as $player){
|
||||
$chunk->addEntity($player);
|
||||
$oldChunk->removeEntity($player);
|
||||
$player->chunk = $chunk;
|
||||
}
|
||||
//TODO: this causes chunkloaders to receive false "unloaded" notifications
|
||||
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
||||
}else{
|
||||
foreach($oldChunk->getEntities() as $entity){
|
||||
|
Loading…
x
Reference in New Issue
Block a user