64        $name = strtolower($name);
 
   65        $path = $this->getPlayerDataPath($name);
 
   67        if(!file_exists($path)){
 
   72            $contents = Filesystem::fileGetContents($path);
 
   73        }
catch(\RuntimeException $e){
 
   77            $decompressed = ErrorToExceptionHandler::trapAndRemoveFalse(fn() => zlib_decode($contents));
 
   78        }
catch(\ErrorException $e){
 
   79            $this->handleCorruptedPlayerData($name);
 
   80            throw new PlayerDataLoadException(
"Failed to decompress raw player data for \"$name\": " . $e->getMessage(), 0, $e);
 
   84            return (
new BigEndianNbtSerializer())->read($decompressed)->mustGetCompoundTag();
 
   85        }
catch(NbtDataException $e){ 
 
   86            $this->handleCorruptedPlayerData($name);
 
   87            throw new PlayerDataLoadException(
"Failed to decode NBT data for \"$name\": " . $e->getMessage(), 0, $e);
 
 
   93        $contents = Utils::assumeNotFalse(zlib_encode($nbt->write(
new TreeRoot($data)), ZLIB_ENCODING_GZIP), 
"zlib_encode() failed unexpectedly");
 
   95            Filesystem::safeFilePutContents($this->getPlayerDataPath($name), $contents);
 
   96        }
catch(\RuntimeException $e){