Class PlayerDeathEvent

java.lang.Object
fr.fidorial.event.entity.EntityDeathEvent
fr.fidorial.event.player.PlayerDeathEvent
All Implemented Interfaces:
Event, PlayerEvent

public final class PlayerDeathEvent extends EntityDeathEvent implements PlayerEvent
Fired when a player dies, before the death message is broadcast and the death screen shown.
Since:
0.1.0
  • Constructor Details

    • PlayerDeathEvent

      public PlayerDeathEvent(Player player, @Nullable Entity killer, @Nullable Component deathMessage)
      Creates an event.
      Parameters:
      player - the player who died
      killer - the entity credited with the kill, or null
      deathMessage - the message to broadcast, or null to stay silent
      Since:
      0.1.0
  • Method Details

    • entity

      public Player entity()
      Returns the player who died.
      Overrides:
      entity in class EntityDeathEvent
      Returns:
      the player who died
      Since:
      0.1.0
    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • deathMessage

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

      public void setDeathMessage(@Nullable Component deathMessage)
      Parameters:
      deathMessage - the message to broadcast instead, or null to broadcast nothing