mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge remote-tracking branch 'origin/next-minor' into next-major
This commit is contained in:
@ -41,7 +41,6 @@ use pocketmine\world\World;
|
||||
use pocketmine\world\WorldCreationOptions;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function array_map;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
@ -138,9 +137,10 @@ class BedrockWorldData extends BaseNbtWorldData{
|
||||
}
|
||||
|
||||
protected function load() : CompoundTag{
|
||||
$rawLevelData = @file_get_contents($this->dataPath);
|
||||
if($rawLevelData === false){
|
||||
throw new CorruptedWorldException("Failed to read level.dat (permission denied or doesn't exist)");
|
||||
try{
|
||||
$rawLevelData = Filesystem::fileGetContents($this->dataPath);
|
||||
}catch(\RuntimeException $e){
|
||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||
}
|
||||
if(strlen($rawLevelData) <= 8){
|
||||
throw new CorruptedWorldException("Truncated level.dat");
|
||||
|
@ -36,7 +36,6 @@ use pocketmine\world\World;
|
||||
use pocketmine\world\WorldCreationOptions;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function ceil;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function microtime;
|
||||
use function zlib_decode;
|
||||
@ -90,9 +89,10 @@ class JavaWorldData extends BaseNbtWorldData{
|
||||
}
|
||||
|
||||
protected function load() : CompoundTag{
|
||||
$rawLevelData = @file_get_contents($this->dataPath);
|
||||
if($rawLevelData === false){
|
||||
throw new CorruptedWorldException("Failed to read level.dat (permission denied or doesn't exist)");
|
||||
try{
|
||||
$rawLevelData = Filesystem::fileGetContents($this->dataPath);
|
||||
}catch(\RuntimeException $e){
|
||||
throw new CorruptedWorldException($e->getMessage(), 0, $e);
|
||||
}
|
||||
$nbt = new BigEndianNbtSerializer();
|
||||
$decompressed = @zlib_decode($rawLevelData);
|
||||
|
Reference in New Issue
Block a user