Update to latest NBT lib version

This commit is contained in:
Dylan K. Taylor
2018-10-23 16:47:00 +01:00
parent a49abff099
commit 011b9ae159
10 changed files with 23 additions and 43 deletions

View File

@@ -751,12 +751,7 @@ class Server{
if(file_exists($path . "$name.dat")){
try{
$nbt = new BigEndianNBTStream();
$compound = $nbt->readCompressed(file_get_contents($path . "$name.dat"));
if(!($compound instanceof CompoundTag)){
throw new \RuntimeException("Invalid data found in \"$name.dat\", expected " . CompoundTag::class . ", got " . (is_object($compound) ? get_class($compound) : gettype($compound)));
}
return $compound;
return $nbt->readCompressed(file_get_contents($path . "$name.dat"));
}catch(\Throwable $e){ //zlib decode error / corrupt data
rename($path . "$name.dat", $path . "$name.dat.bak");
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerCorrupted", [$name]));