pocketmine\Server::saveOfflinePlayerData PHP Method

saveOfflinePlayerData() public method

public saveOfflinePlayerData ( string $name, CompoundTag $nbtTag, boolean $async = false )
$name string
$nbtTag pocketmine\nbt\tag\CompoundTag
$async boolean
    public function saveOfflinePlayerData($name, CompoundTag $nbtTag, $async = false)
    {
        if ($this->shouldSavePlayerData()) {
            $nbt = new NBT(NBT::BIG_ENDIAN);
            try {
                $nbt->setData($nbtTag);
                if ($async) {
                    $this->getScheduler()->scheduleAsyncTask(new FileWriteTask($this->getDataPath() . "players/" . strtolower($name) . ".dat", $nbt->writeCompressed()));
                } else {
                    file_put_contents($this->getDataPath() . "players/" . strtolower($name) . ".dat", $nbt->writeCompressed());
                }
            } catch (\Throwable $e) {
                $this->logger->critical($this->getLanguage()->translateString("pocketmine.data.saveError", [$name, $e->getMessage()]));
                $this->logger->logException($e);
            }
        }
    }
Server