Skip to content

PlayerDataSaveEvent ​

class · pocketmine\event\player\PlayerDataSaveEvent · source

Extends Event
Implements Cancellable

Called when a player's data is about to be saved to disk.

Properties ​

$data ​

php
public \pocketmine\nbt\tag\CompoundTag $data

$playerName ​

php
public string $playerName

Methods ​

__construct() ​

php
public function __construct(\pocketmine\nbt\tag\CompoundTag $data, string $playerName, ?\pocketmine\player\Player $player)

getPlayer() ​

php
public function getPlayer() : ?\pocketmine\player\Player

Returns the player whose data is being saved, if online. If null, this data is for an offline player (possibly just disconnected).

getPlayerName() ​

php
public function getPlayerName() : string

Returns the username of the player whose data is being saved. This is not necessarily an online player.

getSaveData() ​

php
public function getSaveData() : \pocketmine\nbt\tag\CompoundTag

Returns the data to be written to disk as a CompoundTag

setSaveData() ​

php
public function setSaveData(\pocketmine\nbt\tag\CompoundTag $data) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.