PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
pocketmine\event\player\PlayerExperienceChangeEvent Class Reference
+ Inheritance diagram for pocketmine\event\player\PlayerExperienceChangeEvent:
+ Collaboration diagram for pocketmine\event\player\PlayerExperienceChangeEvent:

Public Member Functions

 __construct (Human $player, private int $oldLevel, private float $oldProgress, private ?int $newLevel, private ?float $newProgress)
 
 call ()
 
 getEntity ()
 
 getEventName ()
 
 getNewLevel ()
 
 getNewProgress ()
 
 getOldLevel ()
 
 getOldProgress ()
 
 isCancelled ()
 
 setNewLevel (?int $newLevel)
 
 setNewProgress (?float $newProgress)
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

Entity $entity
 
string $eventName = null
 

Detailed Description

Called when a player gains or loses XP levels and/or progress. @phpstan-extends EntityEvent<Human>

Definition at line 35 of file PlayerExperienceChangeEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\player\PlayerExperienceChangeEvent::__construct ( Human  $player,
private int  $oldLevel,
private float  $oldProgress,
private ?int  $newLevel,
private ?float  $newProgress 
)

Definition at line 38 of file PlayerExperienceChangeEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getEntity()

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getNewLevel()

pocketmine\event\player\PlayerExperienceChangeEvent::getNewLevel ( )
Returns
int|null null indicates no change

Definition at line 59 of file PlayerExperienceChangeEvent.php.

◆ getNewProgress()

pocketmine\event\player\PlayerExperienceChangeEvent::getNewProgress ( )
Returns
float|null null indicates no change

Definition at line 66 of file PlayerExperienceChangeEvent.php.

◆ getOldLevel()

pocketmine\event\player\PlayerExperienceChangeEvent::getOldLevel ( )

Definition at line 48 of file PlayerExperienceChangeEvent.php.

◆ getOldProgress()

pocketmine\event\player\PlayerExperienceChangeEvent::getOldProgress ( )

Definition at line 52 of file PlayerExperienceChangeEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

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 ( )
inherited

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.

◆ setNewLevel()

pocketmine\event\player\PlayerExperienceChangeEvent::setNewLevel ( ?int  $newLevel)

Definition at line 70 of file PlayerExperienceChangeEvent.php.

◆ setNewProgress()

pocketmine\event\player\PlayerExperienceChangeEvent::setNewProgress ( ?float  $newProgress)

Definition at line 74 of file PlayerExperienceChangeEvent.php.

Member Data Documentation

◆ $entity

◆ $eventName

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

Definition at line 38 of file Event.php.


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