Documentation

PlayerDeathEvent extends EntityDeathEvent
in package

Table of Contents

MAX_EVENT_CALL_DEPTH  = 50
$entity  : Entity
$eventName  : string|null
$player  : Player
$deathMessage  : Translatable|string
$drops  : array<string|int, Item>
$eventCallDepth  : int
$keepInventory  : bool
$xp  : int
__construct()  : mixed
call()  : void
Calls event handlers registered for this event.
deriveMessage()  : Translatable
Returns the vanilla death message for the given death cause.
getDeathMessage()  : Translatable|string
getDrops()  : array<string|int, Item>
getEntity()  : Player
getEventName()  : string
getKeepInventory()  : bool
getPlayer()  : Player
getXpDropAmount()  : int
Returns how much experience is dropped due to this entity's death.
setDeathMessage()  : void
setDrops()  : void
setKeepInventory()  : void
setXpDropAmount()  : void

Constants

MAX_EVENT_CALL_DEPTH

private mixed MAX_EVENT_CALL_DEPTH = 50

Properties

$eventName

protected string|null $eventName = null

$eventCallDepth

private static int $eventCallDepth = 1

Methods

__construct()

public __construct(Player $entity, array<string|int, Item$drops, int $xp, string|Translatable|null $deathMessage) : mixed
Parameters
$entity : Player
$drops : array<string|int, Item>
$xp : int
$deathMessage : string|Translatable|null

Null will cause the default vanilla message to be used

Return values
mixed

call()

Calls event handlers registered for this event.

public call() : void
Tags
throws
RuntimeException

if event call recursion reaches the max depth limit

Return values
void

getEventName()

public final getEventName() : string
Return values
string

getKeepInventory()

public getKeepInventory() : bool
Return values
bool

getXpDropAmount()

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

public getXpDropAmount() : int
Return values
int

setDrops()

public setDrops(array<string|int, Item$drops) : void
Parameters
$drops : array<string|int, Item>
Return values
void

setKeepInventory()

public setKeepInventory(bool $keepInventory) : void
Parameters
$keepInventory : bool
Return values
void

setXpDropAmount()

public setXpDropAmount(int $xp) : void
Parameters
$xp : int
Tags
throws
InvalidArgumentException
Return values
void

Search results