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
$entity
protected
Entity
$entity
Tags
$eventName
protected
string|null
$eventName
= null
$player
protected
Player
$player
$deathMessage
private
Translatable|string
$deathMessage
$drops
private
array<string|int, Item>
$drops
= []
$eventCallDepth
private
static int
$eventCallDepth
= 1
$keepInventory
private
bool
$keepInventory
= false
$xp
private
int
$xp
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
Return values
void —deriveMessage()
Returns the vanilla death message for the given death cause.
public
static deriveMessage(string $name, EntityDamageEvent|null $deathCause) : Translatable
Parameters
- $name : string
- $deathCause : EntityDamageEvent|null
Return values
Translatable —getDeathMessage()
public
getDeathMessage() : Translatable|string
Return values
Translatable|string —getDrops()
public
getDrops() : array<string|int, Item>
Return values
array<string|int, Item> —getEntity()
public
getEntity() : Player
Return values
Player —getEventName()
public
final getEventName() : string
Return values
string —getKeepInventory()
public
getKeepInventory() : bool
Return values
bool —getPlayer()
public
getPlayer() : Player
Return values
Player —getXpDropAmount()
Returns how much experience is dropped due to this entity's death.
public
getXpDropAmount() : int
Return values
int —setDeathMessage()
public
setDeathMessage(Translatable|string $deathMessage) : void
Parameters
- $deathMessage : Translatable|string
Return values
void —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