mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
BaseLevelProvider: clean up not-exists error handling disaster
It checks for the existence of (and creates) the world directory if it doesn't exist. But what sense does this make when the world obviously doesn't exist in this case and must be generated first?
This commit is contained in:
@ -100,8 +100,12 @@ class LevelDB extends BaseLevelProvider{
|
||||
}
|
||||
|
||||
protected function loadLevelData() : void{
|
||||
$levelDatPath = $this->getPath() . "level.dat";
|
||||
if(!file_exists($levelDatPath)){
|
||||
throw new LevelException("level.dat not found");
|
||||
}
|
||||
$nbt = new LittleEndianNBTStream();
|
||||
$levelData = $nbt->read(substr(file_get_contents($this->getPath() . "level.dat"), 8));
|
||||
$levelData = $nbt->read(substr(file_get_contents($levelDatPath), 8));
|
||||
if($levelData instanceof CompoundTag){
|
||||
$this->levelData = $levelData;
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user