Package org.bukkit.event.entity
Class EntityDeathEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityDeathEvent
- All Implemented Interfaces:
- Cancellable
- Direct Known Subclasses:
- PlayerDeathEvent
Thrown whenever a LivingEntity dies
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.entity.EntityEvententity
- 
Constructor SummaryConstructorsConstructorDescriptionEntityDeathEvent(@NotNull LivingEntity entity, @NotNull List<ItemStack> drops) EntityDeathEvent(@NotNull LivingEntity what, @NotNull List<ItemStack> drops, int droppedExp) 
- 
Method SummaryModifier and TypeMethodDescriptionGet the sound that the entity makes when dyingGet the sound category that the death sound should play infloatGet the pitch that the death sound will play with.floatGet the volume that the death sound will play at.intGets how much EXP should be dropped from this death.getDrops()Gets all the items which will drop when the entity diesReturns the Entity involved in this eventstatic @NotNull HandlerListdoubleGet the amount of health that the entity should revive with after cancelling the event.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetDeathSound(Sound sound) Set the sound that the entity makes when dyingvoidsetDeathSoundCategory(SoundCategory soundCategory) Set the sound category that the death sound should play in.voidsetDeathSoundPitch(float pitch) Set the pitch that the death sound should play with.voidsetDeathSoundVolume(float volume) Set the volume the death sound should play at.voidsetDroppedExp(int exp) Sets how much EXP should be dropped from this death.voidsetReviveHealth(double reviveHealth) Set the amount of health that the entity should revive with after cancelling the event.voidsetShouldPlayDeathSound(boolean playDeathSound) Set whether or not the death sound should play when the entity dies.booleanWhether or not the death sound should play when the entity dies.Methods inherited from class org.bukkit.event.entity.EntityEventgetEntityTypeMethods inherited from class org.bukkit.event.EventcallEvent, getEventName, isAsynchronous
- 
Constructor Details- 
EntityDeathEvent
- 
EntityDeathEvent
 
- 
- 
Method Details- 
getEntityDescription copied from class:EntityEventReturns the Entity involved in this event- Overrides:
- getEntityin class- EntityEvent
- Returns:
- Entity who is involved in this event
 
- 
getDroppedExppublic int getDroppedExp()Gets how much EXP should be dropped from this death.This does not indicate how much EXP should be taken from the entity in question, merely how much should be created after its death. - Returns:
- Amount of EXP to drop.
 
- 
setDroppedExppublic void setDroppedExp(int exp) Sets how much EXP should be dropped from this death.This does not indicate how much EXP should be taken from the entity in question, merely how much should be created after its death. - Parameters:
- exp- Amount of EXP to drop.
 
- 
getDropsGets all the items which will drop when the entity dies- Returns:
- Items to drop when the entity dies
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
- 
isCancelledpublic boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
- isCancelledin interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
setCancelledpublic void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
- setCancelledin interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
- 
getReviveHealthpublic double getReviveHealth()Get the amount of health that the entity should revive with after cancelling the event. Set to the entity's max health by default.- Returns:
- The amount of health
 
- 
setReviveHealthSet the amount of health that the entity should revive with after cancelling the event. Revive health value must be between 0 (exclusive) and the entity's max health (inclusive).- Parameters:
- reviveHealth- The amount of health
- Throws:
- IllegalArgumentException- Thrown if the health is <= 0 or > max health
 
- 
shouldPlayDeathSoundpublic boolean shouldPlayDeathSound()Whether or not the death sound should play when the entity dies. If the event is cancelled it does not play!- Returns:
- Whether or not the death sound should play. Event is called with this set to false if the entity is silent.
 
- 
setShouldPlayDeathSoundpublic void setShouldPlayDeathSound(boolean playDeathSound) Set whether or not the death sound should play when the entity dies. If the event is cancelled it does not play!- Parameters:
- playDeathSound- Enable or disable the death sound
 
- 
getDeathSoundGet the sound that the entity makes when dying- Returns:
- The sound that the entity makes
 
- 
setDeathSoundSet the sound that the entity makes when dying- Parameters:
- sound- The sound that the entity should make when dying
 
- 
getDeathSoundCategoryGet the sound category that the death sound should play in- Returns:
- The sound category
 
- 
setDeathSoundCategorySet the sound category that the death sound should play in.- Parameters:
- soundCategory- The sound category
 
- 
getDeathSoundVolumepublic float getDeathSoundVolume()Get the volume that the death sound will play at.- Returns:
- The volume the death sound will play at
 
- 
setDeathSoundVolumepublic void setDeathSoundVolume(float volume) Set the volume the death sound should play at. If the event is cancelled this will not play the sound!- Parameters:
- volume- The volume the death sound should play at
 
- 
getDeathSoundPitchpublic float getDeathSoundPitch()Get the pitch that the death sound will play with.- Returns:
- The pitch the death sound will play with
 
- 
setDeathSoundPitchpublic void setDeathSoundPitch(float pitch) Set the pitch that the death sound should play with.- Parameters:
- pitch- The pitch the death sound should play with
 
 
-