Class PlayerDeathEvent

java.lang.Object
net.minestom.server.event.player.PlayerDeathEvent
All Implemented Interfaces:
Event, EntityEvent, EntityInstanceEvent, InstanceEvent, PlayerEvent, PlayerInstanceEvent

public class PlayerDeathEvent extends Object implements PlayerInstanceEvent
Called when a player die in Player.kill().
  • Constructor Details

    • PlayerDeathEvent

      public PlayerDeathEvent(@NotNull @NotNull Player player, Component deathText, Component chatMessage)
  • Method Details

    • getDeathText

      @Nullable public @Nullable Component getDeathText()
      Gets the text displayed in the death screen.
      Returns:
      the death text, can be null
    • setDeathText

      public void setDeathText(@Nullable @Nullable Component deathText)
      Changes the text displayed in the death screen.
      Parameters:
      deathText - the death text to display, null to remove
    • getChatMessage

      @Nullable public @Nullable Component getChatMessage()
      Gets the message sent to chat.
      Returns:
      the death chat message
    • setChatMessage

      public void setChatMessage(@Nullable @Nullable Component chatMessage)
      Changes the text sent in chat
      Parameters:
      chatMessage - the death message to send, null to remove
    • getPlayer

      @NotNull public @NotNull Player getPlayer()
      Description copied from interface: PlayerEvent
      Gets the player.
      Specified by:
      getPlayer in interface PlayerEvent
      Returns:
      the player