Interface PlayerDeathEvent

All Superinterfaces:
EntityDeathEvent, Event, PlayerEvent

public interface PlayerDeathEvent extends EntityDeathEvent, 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 Type
    Method
    Description
    Returns the message broadcast to the server, or null if the death stays silent.
    Returns the player who died.
    boolean
    Returns whether the player keeps their inventory; when not, it is dropped on the ground where they died.
    void
    Replaces the message broadcast to the server.
    void
    setKeepInventory(boolean keepInventory)
    Sets whether the player keeps their inventory instead of dropping it where they died.

    Methods inherited from interface EntityDeathEvent

    killer

    Methods inherited from interface PlayerEvent

    player
  • Method Details

    • entity

      Player entity()
      Returns the player who died.
      Specified by:
      entity in interface EntityDeathEvent
      Returns:
      the player who died
      Since:
      0.1.0
    • deathMessage

      @Nullable Component deathMessage()
      Returns the message broadcast to the server, or null if the death stays silent.
      Returns:
      the message broadcast to the server, or null if the death stays silent
      Since:
      0.1.0
    • setDeathMessage

      void setDeathMessage(@Nullable Component deathMessage)
      Replaces the message broadcast to the server.
      Parameters:
      deathMessage - the message to broadcast instead, or null to broadcast nothing
      Since:
      0.1.0
    • 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_inventory game 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 - true to keep it
      Since:
      0.1.0