Interface DestructEntityEvent.Death
-
- All Superinterfaces:
AudienceMessageEvent
,Cancellable
,DestructEntityEvent
,Event
,MessageCancellable
,MessageEvent
- Enclosing interface:
- DestructEntityEvent
public static interface DestructEntityEvent.Death extends DestructEntityEvent, Cancellable
A derivative ofDestructEntityEvent
where the removal of theLiving
, theDestructEntityEvent.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.event.entity.DestructEntityEvent
DestructEntityEvent.Death
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Living
entity()
Gets theEntity
.boolean
keepInventory()
Returns whether the inventory is kept after death.void
setKeepInventory(boolean keepInventory)
Applies theGameRules.KEEP_INVENTORY
gamerule to this entity alone.-
Methods inherited from interface org.spongepowered.api.event.message.AudienceMessageEvent
audience, filterAudience, originalAudience, setAudience
-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
Methods inherited from interface org.spongepowered.api.event.message.MessageCancellable
isMessageCancelled, setMessageCancelled
-
Methods inherited from interface org.spongepowered.api.event.message.MessageEvent
message, originalMessage, setMessage
-
-
-
-
Method Detail
-
entity
Living entity()
Description copied from interface:DestructEntityEvent
Gets theEntity
.- Specified by:
entity
in interfaceDestructEntityEvent
- Returns:
- The entity
-
setKeepInventory
void setKeepInventory(boolean keepInventory)
Applies theGameRules.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.
-
-