PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\event\player\PlayerDeathEvent Class Reference
+ Inheritance diagram for pocketmine\event\player\PlayerDeathEvent:
+ Collaboration diagram for pocketmine\event\player\PlayerDeathEvent:

Public Member Functions

 __construct (Player $entity, array $drops, int $xp, Translatable|string|null $deathMessage)
 
 call ()
 
 getDeathMessage ()
 
 getDeathScreenMessage ()
 
 getDrops ()
 
 getEntity ()
 
 getEventName ()
 
 getKeepInventory ()
 
 getKeepXp ()
 
 getPlayer ()
 
 getXpDropAmount ()
 
 setDeathMessage (Translatable|string $deathMessage)
 
 setDeathScreenMessage (Translatable|string $deathScreenMessage)
 
 setDrops (array $drops)
 
 setKeepInventory (bool $keepInventory)
 
 setKeepXp (bool $keepXp)
 
 setXpDropAmount (int $xp)
 

Static Public Member Functions

static deriveMessage (string $name, ?EntityDamageEvent $deathCause)
 
static hasHandlers ()
 

Protected Attributes

Entity $entity
 
string $eventName = null
 
Player $player
 

Detailed Description

Definition at line 38 of file PlayerDeathEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\player\PlayerDeathEvent::__construct ( Player  $entity,
array  $drops,
int  $xp,
Translatable|string|null  $deathMessage 
)
Parameters
Item[]$drops
string | Translatable | null$deathMessageNull will cause the default vanilla message to be used

Definition at line 50 of file PlayerDeathEvent.php.

References pocketmine\event\entity\EntityEvent\$entity, and pocketmine\event\player\PlayerDeathEvent\deriveMessage().

+ Here is the call graph for this function:

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.

◆ deriveMessage()

static pocketmine\event\player\PlayerDeathEvent::deriveMessage ( string  $name,
?EntityDamageEvent  $deathCause 
)
static

Returns the vanilla death message for the given death cause.

Definition at line 103 of file PlayerDeathEvent.php.

Referenced by pocketmine\event\player\PlayerDeathEvent\__construct().

+ Here is the caller graph for this function:

◆ getDeathMessage()

pocketmine\event\player\PlayerDeathEvent::getDeathMessage ( )

Definition at line 68 of file PlayerDeathEvent.php.

◆ getDeathScreenMessage()

pocketmine\event\player\PlayerDeathEvent::getDeathScreenMessage ( )

Definition at line 76 of file PlayerDeathEvent.php.

◆ getDrops()

pocketmine\event\entity\EntityDeathEvent::getDrops ( )
inherited
Returns
Item[]

Definition at line 56 of file EntityDeathEvent.php.

◆ getEntity()

pocketmine\event\player\PlayerDeathEvent::getEntity ( )
Returns
Player

Reimplemented from pocketmine\event\entity\EntityDeathEvent.

Definition at line 60 of file PlayerDeathEvent.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getKeepInventory()

pocketmine\event\player\PlayerDeathEvent::getKeepInventory ( )

Definition at line 84 of file PlayerDeathEvent.php.

◆ getKeepXp()

pocketmine\event\player\PlayerDeathEvent::getKeepXp ( )

Definition at line 92 of file PlayerDeathEvent.php.

◆ getPlayer()

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

Definition at line 64 of file PlayerDeathEvent.php.

◆ getXpDropAmount()

pocketmine\event\entity\EntityDeathEvent::getXpDropAmount ( )
inherited

Returns how much experience is dropped due to this entity's death.

Definition at line 71 of file EntityDeathEvent.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.

◆ setDeathMessage()

pocketmine\event\player\PlayerDeathEvent::setDeathMessage ( Translatable|string  $deathMessage)

Definition at line 72 of file PlayerDeathEvent.php.

◆ setDeathScreenMessage()

pocketmine\event\player\PlayerDeathEvent::setDeathScreenMessage ( Translatable|string  $deathScreenMessage)

Definition at line 80 of file PlayerDeathEvent.php.

◆ setDrops()

pocketmine\event\entity\EntityDeathEvent::setDrops ( array  $drops)
inherited
Parameters
Item[]$drops

Definition at line 63 of file EntityDeathEvent.php.

◆ setKeepInventory()

pocketmine\event\player\PlayerDeathEvent::setKeepInventory ( bool  $keepInventory)

Definition at line 88 of file PlayerDeathEvent.php.

◆ setKeepXp()

pocketmine\event\player\PlayerDeathEvent::setKeepXp ( bool  $keepXp)

Definition at line 96 of file PlayerDeathEvent.php.

◆ setXpDropAmount()

pocketmine\event\entity\EntityDeathEvent::setXpDropAmount ( int  $xp)
inherited
Exceptions

InvalidArgumentException

Definition at line 78 of file EntityDeathEvent.php.

Member Data Documentation

◆ $entity

◆ $eventName

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

Definition at line 38 of file Event.php.

◆ $player

Player pocketmine\event\player\PlayerDeathEvent::$player
protected

Definition at line 39 of file PlayerDeathEvent.php.


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