mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Level: Unload chunks prior to save() to avoid saving chunks twice on shutdown
save() calls saveChunks() which saves any chunks found to be modified. But chunk unloading does this anyway, so it's better to unload first and then trigger the save mechanism, to avoid saving chunks twice.
This commit is contained in:
parent
73a5788774
commit
1f77c074e9
@ -450,14 +450,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
throw new \InvalidStateException("Tried to close a level which is already closed");
|
||||
}
|
||||
|
||||
if($this->getAutoSave()){
|
||||
$this->save();
|
||||
}
|
||||
|
||||
foreach($this->chunks as $chunk){
|
||||
$this->unloadChunk($chunk->getX(), $chunk->getZ(), false);
|
||||
}
|
||||
|
||||
if($this->getAutoSave()){
|
||||
$this->save();
|
||||
}
|
||||
|
||||
$this->unregisterGenerator();
|
||||
|
||||
$this->provider->close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user