data = $nbt; $this->playerName = $playerName; } /** * Returns the data to be written to disk as a CompoundTag */ public function getSaveData() : CompoundTag{ return $this->data; } public function setSaveData(CompoundTag $data) : void{ $this->data = $data; } /** * Returns the username of the player whose data is being saved. This is not necessarily an online player. */ public function getPlayerName() : string{ return $this->playerName; } /** * Returns the player whose data is being saved. This may be a Player or an OfflinePlayer. * @return IPlayer (Player or OfflinePlayer) */ public function getPlayer() : IPlayer{ return Server::getInstance()->getOfflinePlayer($this->playerName); } }