mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
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:
parent
559504225a
commit
0e7f364a41
@ -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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user