diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 0c26daaf6..817b1eae4 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -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();