PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\event\player\PlayerDataSaveEvent Class Reference
+ Inheritance diagram for pocketmine\event\player\PlayerDataSaveEvent:
+ Collaboration diagram for pocketmine\event\player\PlayerDataSaveEvent:

Public Member Functions

 __construct (protected CompoundTag $data, protected string $playerName, private ?Player $player)
 call ()
 getEventName ()
 getPlayer ()
 getPlayerName ()
 getSaveData ()
 isCancelled ()
 setSaveData (CompoundTag $data)

Static Public Member Functions

static hasHandlers ()

Protected Attributes

string $eventName = null

Detailed Description

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

Definition at line 35 of file PlayerDataSaveEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\player\PlayerDataSaveEvent::__construct ( protected CompoundTag  $data,
protected string  $playerName,
private ?Player  $player 

Definition at line 38 of file PlayerDataSaveEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )

Calls event handlers registered for this event.


RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )

Definition at line 40 of file Event.php.

◆ getPlayer()

pocketmine\event\player\PlayerDataSaveEvent::getPlayer ( )

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

Definition at line 66 of file PlayerDataSaveEvent.php.

◆ getPlayerName()

pocketmine\event\player\PlayerDataSaveEvent::getPlayerName ( )

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

Definition at line 58 of file PlayerDataSaveEvent.php.

◆ getSaveData()

pocketmine\event\player\PlayerDataSaveEvent::getSaveData ( )

Returns the data to be written to disk as a CompoundTag

Definition at line 47 of file PlayerDataSaveEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ isCancelled()

pocketmine\event\Cancellable::isCancelled ( )

Returns whether this instance of the event is currently cancelled.

If it is cancelled, only downstream handlers that declare @handleCancelled will be called with this event.

◆ setSaveData()

pocketmine\event\player\PlayerDataSaveEvent::setSaveData ( CompoundTag  $data)

Definition at line 51 of file PlayerDataSaveEvent.php.

Member Data Documentation

◆ $eventName

string pocketmine\event\Event::$eventName = null

Definition at line 38 of file Event.php.

The documentation for this class was generated from the following file: