mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
Player: clean up refs when forced chunk unload is detected
this might happen because of a plugin, or low memory condition.
This commit is contained in:
parent
cc91cbd8c5
commit
3aca03d262
@ -2348,6 +2348,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
|
||||
use ChunkListenerNoOpTrait {
|
||||
onChunkChanged as private;
|
||||
onChunkUnloaded as private;
|
||||
}
|
||||
|
||||
public function onChunkChanged(Chunk $chunk) : void{
|
||||
@ -2356,4 +2357,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$this->nextChunkOrderRun = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function onChunkUnloaded(Chunk $chunk) : void{
|
||||
if($this->isUsingChunk($chunk->getX(), $chunk->getZ())){
|
||||
$this->logger->debug("Detected forced unload of chunk " . $chunk->getX() . " " . $chunk->getZ());
|
||||
$this->unloadChunk($chunk->getX(), $chunk->getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user