Interface PlayerDeathEvent
- All Superinterfaces:
EntityDeathEvent, Event, PlayerEvent
Fired when a player dies, before the death message is broadcast and the death screen shown.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the message broadcast to the server, ornullif the death stays silent.entity()Returns the player who died.booleanReturns whether the player keeps their inventory; when not, it is dropped on the ground where they died.voidsetDeathMessage(@Nullable Component deathMessage) Replaces the message broadcast to the server.voidsetKeepInventory(boolean keepInventory) Sets whether the player keeps their inventory instead of dropping it where they died.Methods inherited from interface EntityDeathEvent
killerMethods inherited from interface PlayerEvent
player
-
Method Details
-
entity
Player entity()Returns the player who died.- Specified by:
entityin interfaceEntityDeathEvent- Returns:
- the player who died
- Since:
- 0.1.0
-
deathMessage
-
setDeathMessage
-
keepInventory
boolean keepInventory()Returns whether the player keeps their inventory; when not, it is dropped on the ground where they died.Starts from the
minecraft:keep_inventorygame rule of the world.- Returns:
- whether the player keeps their inventory; when not, it is dropped on the ground where they died
- Since:
- 0.1.0
-
setKeepInventory
void setKeepInventory(boolean keepInventory) Sets whether the player keeps their inventory instead of dropping it where they died.- Parameters:
keepInventory-trueto keep it- Since:
- 0.1.0
-