mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
ChunkCache: destroy cache when world is unloaded
This commit is contained in:
parent
3ce9a4801f
commit
b74f177958
@ -74,6 +74,12 @@ class ChunkCache implements ChunkListener{
|
||||
private function __construct(World $world, Compressor $compressor){
|
||||
$this->world = $world;
|
||||
$this->compressor = $compressor;
|
||||
$worldId = spl_object_id($world);
|
||||
$this->world->addOnUnloadCallback(function() use ($worldId) : void{
|
||||
$this->caches = [];
|
||||
unset(self::$instances[$worldId]);
|
||||
\GlobalLogger::get()->debug("Destroyed chunk packet caches for world#$worldId");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user