diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 1229c27b1..646660bfd 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3515,11 +3515,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ /** * Handles player data saving * - * @param bool $async - * * @throws \InvalidStateException if the player is closed */ - public function save(bool $async = false){ + public function save(){ if($this->closed){ throw new \InvalidStateException("Tried to save closed player"); } @@ -3556,7 +3554,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->namedtag->setLong("lastPlayed", (int) floor(microtime(true) * 1000)); if($this->username != "" and $this->namedtag instanceof CompoundTag){ - $this->server->saveOfflinePlayerData($this->username, $this->namedtag, $async); + $this->server->saveOfflinePlayerData($this->username, $this->namedtag); } } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 80263789b..3164b6cd9 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -805,9 +805,8 @@ class Server{ /** * @param string $name * @param CompoundTag $nbtTag - * @param bool $async */ - public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag, bool $async = false){ + public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag){ $ev = new PlayerDataSaveEvent($nbtTag, $name); $ev->setCancelled(!$this->shouldSavePlayerData()); @@ -816,11 +815,7 @@ class Server{ if(!$ev->isCancelled()){ $nbt = new BigEndianNBTStream(); try{ - if($async){ - $this->asyncPool->submitTask(new FileWriteTask($this->getDataPath() . "players/" . strtolower($name) . ".dat", $nbt->writeCompressed($ev->getSaveData()))); - }else{ - file_put_contents($this->getDataPath() . "players/" . strtolower($name) . ".dat", $nbt->writeCompressed($ev->getSaveData())); - } + file_put_contents($this->getDataPath() . "players/" . strtolower($name) . ".dat", $nbt->writeCompressed($ev->getSaveData())); }catch(\Throwable $e){ $this->logger->critical($this->getLanguage()->translateString("pocketmine.data.saveError", [$name, $e->getMessage()])); $this->logger->logException($e); @@ -2404,7 +2399,7 @@ class Server{ Timings::$worldSaveTimer->startTiming(); foreach($this->players as $index => $player){ if($player->spawned){ - $player->save(true); + $player->save(); }elseif(!$player->isConnected()){ $this->removePlayer($player); }