mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
ÂBedrockWorldData: throw less confusing errors on missing version tags
This commit is contained in:
parent
ff0199cdf8
commit
eb9f804781
@ -43,6 +43,7 @@ use pocketmine\world\WorldCreationOptions;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
use function array_map;
|
||||
use function file_put_contents;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use function time;
|
||||
@ -154,12 +155,18 @@ class BedrockWorldData extends BaseNbtWorldData{
|
||||
}
|
||||
|
||||
$version = $worldData->getInt(self::TAG_STORAGE_VERSION, Limits::INT32_MAX);
|
||||
if($version === Limits::INT32_MAX){
|
||||
throw new CorruptedWorldException(sprintf("Missing '%s' tag in level.dat", self::TAG_STORAGE_VERSION));
|
||||
}
|
||||
if($version > self::CURRENT_STORAGE_VERSION){
|
||||
throw new UnsupportedWorldFormatException("LevelDB world format version $version is currently unsupported");
|
||||
}
|
||||
//StorageVersion is rarely updated - instead, the game relies on the NetworkVersion tag, which is synced with
|
||||
//the network protocol version for that version.
|
||||
$protocolVersion = $worldData->getInt(self::TAG_NETWORK_VERSION, Limits::INT32_MAX);
|
||||
if($protocolVersion === Limits::INT32_MAX){
|
||||
throw new CorruptedWorldException(sprintf("Missing '%s' tag in level.dat", self::TAG_NETWORK_VERSION));
|
||||
}
|
||||
if($protocolVersion > self::CURRENT_STORAGE_NETWORK_VERSION){
|
||||
throw new UnsupportedWorldFormatException("LevelDB world protocol version $protocolVersion is currently unsupported");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user