Interface DestructEntityEvent.Death

All Superinterfaces:
AudienceMessageEvent, Cancellable, DestructEntityEvent, Event, MessageCancellable, MessageEvent
Enclosing interface:
DestructEntityEvent

public static interface DestructEntityEvent.Death extends DestructEntityEvent, Cancellable
A derivative of DestructEntityEvent where the removal of the Living, the DestructEntityEvent.entity(), is due to it losing its health.

Note that cancelling this event will have the implication that the entity will have restored health and not enter a "death" state to play a dying animation, drop items, and drop experience. It is highly encouraged to keep the cancellation of this event at a mimium as in modded environments, cancelling this event may have other implications that mods may not consider and cause bugs.

  • Method Details

    • entity

      Living entity()
      Description copied from interface: DestructEntityEvent
      Gets the Entity.
      Specified by:
      entity in interface DestructEntityEvent
      Returns:
      The entity
    • setKeepInventory

      void setKeepInventory(boolean keepInventory)
      Applies the GameRules.KEEP_INVENTORY gamerule to this entity alone.

      This only works for players

      Parameters:
      keepInventory - Whether to keep the inventory on death
    • keepInventory

      boolean keepInventory()
      Returns whether the inventory is kept after death.

      By default this is the same as the GameRules.KEEP_INVENTORY gamerule.

      Returns:
      Whether the inventory is kept after death.