Fixed chunk object memory leak when chunks are changed, close #419

If a player quit the server in the 1-second between a chunk changing and a fresh chunk-order requesting a resend of that chunk, the player wouldn't know they were using that chunk and did not unregister themselves, causing the subject chunks to always remain loaded.
This commit is contained in:
Dylan K. Taylor 2017-04-24 11:55:33 +01:00
parent 559504225a
commit 0e7f364a41

View File

@ -4088,7 +4088,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
}
public function onChunkChanged(Chunk $chunk){
unset($this->usedChunks[Level::chunkHash($chunk->getX(), $chunk->getZ())]);
if(isset($this->usedChunks[$hash = Level::chunkHash($chunk->getX(), $chunk->getZ())])){
$this->usedChunks[$hash] = false;
}
}
public function onChunkLoaded(Chunk $chunk){