Interface DestructEntityEvent.Death
- All Superinterfaces:
AudienceMessageEvent
,Cancellable
,DestructEntityEvent
,Event
,MessageCancellable
,MessageEvent
- Enclosing interface:
DestructEntityEvent
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.event.entity.DestructEntityEvent
DestructEntityEvent.Death
-
Method Summary
Modifier and TypeMethodDescriptionentity()
Gets theEntity
.boolean
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 Details
-
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.
-