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.booleanReturns whether the inventory is kept after death.voidsetKeepInventory(boolean keepInventory) Applies theGameRules.KEEP_INVENTORYgamerule to this entity alone.Methods inherited from interface org.spongepowered.api.event.message.AudienceMessageEvent
audience, filterAudience, originalAudience, setAudienceMethods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelledMethods inherited from interface org.spongepowered.api.event.message.MessageCancellable
isMessageCancelled, setMessageCancelledMethods inherited from interface org.spongepowered.api.event.message.MessageEvent
message, originalMessage, setMessage
-
Method Details
-
entity
Living entity()Description copied from interface:DestructEntityEventGets theEntity.- Specified by:
entityin interfaceDestructEntityEvent- Returns:
- The entity
-
setKeepInventory
void setKeepInventory(boolean keepInventory) Applies theGameRules.KEEP_INVENTORYgamerule 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_INVENTORYgamerule.- Returns:
- Whether the inventory is kept after death.
-