mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Merge branch 'release/3.5'
This commit is contained in:
@ -48,6 +48,8 @@ use pocketmine\level\biome\Biome;
|
||||
use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\format\ChunkException;
|
||||
use pocketmine\level\format\EmptySubChunk;
|
||||
use pocketmine\level\format\io\exception\CorruptedChunkException;
|
||||
use pocketmine\level\format\io\exception\UnsupportedChunkFormatException;
|
||||
use pocketmine\level\format\io\LevelProvider;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\GeneratorManager;
|
||||
@ -2652,10 +2654,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
try{
|
||||
$chunk = $this->provider->loadChunk($x, $z);
|
||||
}catch(\Exception $e){
|
||||
}catch(CorruptedChunkException | UnsupportedChunkFormatException $e){
|
||||
$logger = $this->server->getLogger();
|
||||
$logger->critical("An error occurred while loading chunk x=$x z=$z: " . $e->getMessage());
|
||||
$logger->logException($e);
|
||||
$logger->critical("Failed to load chunk x=$x z=$z: " . $e->getMessage());
|
||||
}
|
||||
|
||||
if($chunk === null and $create){
|
||||
@ -2736,23 +2737,17 @@ class Level implements ChunkManager, Metadatable{
|
||||
return false;
|
||||
}
|
||||
|
||||
try{
|
||||
if($trySave and $this->getAutoSave() and $chunk->isGenerated()){
|
||||
if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or count($chunk->getSavableEntities()) > 0){
|
||||
$this->provider->saveChunk($chunk);
|
||||
}
|
||||
if($trySave and $this->getAutoSave() and $chunk->isGenerated()){
|
||||
if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or count($chunk->getSavableEntities()) > 0){
|
||||
$this->provider->saveChunk($chunk);
|
||||
}
|
||||
|
||||
foreach($this->getChunkLoaders($x, $z) as $loader){
|
||||
$loader->onChunkUnloaded($chunk);
|
||||
}
|
||||
|
||||
$chunk->onUnload();
|
||||
}catch(\Throwable $e){
|
||||
$logger = $this->server->getLogger();
|
||||
$logger->error($this->server->getLanguage()->translateString("pocketmine.level.chunkUnloadError", [$e->getMessage()]));
|
||||
$logger->logException($e);
|
||||
}
|
||||
|
||||
foreach($this->getChunkLoaders($x, $z) as $loader){
|
||||
$loader->onChunkUnloaded($chunk);
|
||||
}
|
||||
|
||||
$chunk->onUnload();
|
||||
}
|
||||
|
||||
unset($this->chunks[$chunkHash]);
|
||||
|
Reference in New Issue
Block a user