mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Catch exceptions when chunks are unloaded
This commit is contained in:
parent
a3e50f6337
commit
a7abd5ff9d
@ -92,6 +92,7 @@ use pocketmine\tile\Chest;
|
|||||||
use pocketmine\tile\Tile;
|
use pocketmine\tile\Tile;
|
||||||
use pocketmine\utils\Cache;
|
use pocketmine\utils\Cache;
|
||||||
use pocketmine\utils\LevelException;
|
use pocketmine\utils\LevelException;
|
||||||
|
use pocketmine\utils\MainLogger;
|
||||||
use pocketmine\utils\ReversePriorityQueue;
|
use pocketmine\utils\ReversePriorityQueue;
|
||||||
use pocketmine\utils\TextFormat;
|
use pocketmine\utils\TextFormat;
|
||||||
|
|
||||||
@ -1876,12 +1877,20 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($chunk instanceof FullChunk and $chunk->hasChanged() and $this->getAutoSave()){
|
try{
|
||||||
$this->provider->setChunk($x, $z, $chunk);
|
if($chunk instanceof FullChunk and $chunk->hasChanged() and $this->getAutoSave()){
|
||||||
$this->provider->saveChunk($x, $z);
|
$this->provider->setChunk($x, $z, $chunk);
|
||||||
|
$this->provider->saveChunk($x, $z);
|
||||||
|
}
|
||||||
|
$this->provider->unloadChunk($x, $z, $safe);
|
||||||
|
}catch (\Exception $e){
|
||||||
|
$logger = $this->server->getLogger();
|
||||||
|
$logger->error("Error when unloading a chunk: ".$e->getMessage());
|
||||||
|
if($logger instanceof MainLogger){
|
||||||
|
$logger->logException($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->provider->unloadChunk($x, $z, $safe);
|
|
||||||
unset($this->chunks[$index]);
|
unset($this->chunks[$index]);
|
||||||
unset($this->usedChunks[$index]);
|
unset($this->usedChunks[$index]);
|
||||||
Cache::remove("world:" . $this->getID() . ":$index");
|
Cache::remove("world:" . $this->getID() . ":$index");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user