Cancellable
PlayerDeathEvent
public class EntityDeathEvent extends EntityEvent implements Cancellable
Event.Result
entity
Constructor | Description |
---|---|
EntityDeathEvent(@NotNull LivingEntity entity,
@NotNull List<ItemStack> drops) |
|
EntityDeathEvent(@NotNull LivingEntity what,
@NotNull List<ItemStack> drops,
int droppedExp) |
Modifier and Type | Method | Description |
---|---|---|
Sound |
getDeathSound() |
Get the sound that the entity makes when dying
|
SoundCategory |
getDeathSoundCategory() |
Get the sound category that the death sound should play in
|
float |
getDeathSoundPitch() |
Get the pitch that the death sound will play with.
|
float |
getDeathSoundVolume() |
Get the volume that the death sound will play at.
|
int |
getDroppedExp() |
Gets how much EXP should be dropped from this death.
|
@NotNull List<ItemStack> |
getDrops() |
Gets all the items which will drop when the entity dies
|
@NotNull LivingEntity |
getEntity() |
Returns the Entity involved in this event
|
static @NotNull HandlerList |
getHandlerList() |
|
@NotNull HandlerList |
getHandlers() |
|
double |
getReviveHealth() |
Get the amount of health that the entity should revive with after cancelling the event.
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
void |
setDeathSound(Sound sound) |
Set the sound that the entity makes when dying
|
void |
setDeathSoundCategory(SoundCategory soundCategory) |
Set the sound category that the death sound should play in.
|
void |
setDeathSoundPitch(float pitch) |
GSetet the pitch that the death sound should play with.
|
void |
setDeathSoundVolume(float volume) |
Set the volume the death sound should play at.
|
void |
setDroppedExp(int exp) |
Sets how much EXP should be dropped from this death.
|
void |
setReviveHealth(double reviveHealth) |
Set the amount of health that the entity should revive with after cancelling the event.
|
void |
setShouldPlayDeathSound(boolean playDeathSound) |
Set whether or not the death sound should play when the entity dies.
|
boolean |
shouldPlayDeathSound() |
Whether or not the death sound should play when the entity dies.
|
getEntityType
callEvent, getEventName, isAsynchronous
public EntityDeathEvent(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull List<ItemStack> drops)
public EntityDeathEvent(@NotNull @NotNull LivingEntity what, @NotNull @NotNull List<ItemStack> drops, int droppedExp)
@NotNull public @NotNull LivingEntity getEntity()
EntityEvent
getEntity
in class EntityEvent
public int getDroppedExp()
This does not indicate how much EXP should be taken from the entity in question, merely how much should be created after its death.
public void setDroppedExp(int exp)
This does not indicate how much EXP should be taken from the entity in question, merely how much should be created after its death.
exp
- Amount of EXP to drop.@NotNull public @NotNull List<ItemStack> getDrops()
@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this eventpublic double getReviveHealth()
public void setReviveHealth(double reviveHealth) throws IllegalArgumentException
reviveHealth
- The amount of healthIllegalArgumentException
- Thrown if the health is <= 0 or > max healthpublic boolean shouldPlayDeathSound()
public void setShouldPlayDeathSound(boolean playDeathSound)
playDeathSound
- Enable or disable the death sound@Nullable public Sound getDeathSound()
public void setDeathSound(@Nullable Sound sound)
sound
- The sound that the entity should make when dying@Nullable public SoundCategory getDeathSoundCategory()
public void setDeathSoundCategory(@Nullable SoundCategory soundCategory)
soundCategory
- The sound categorypublic float getDeathSoundVolume()
public void setDeathSoundVolume(float volume)
volume
- The volume the death sound should play atpublic float getDeathSoundPitch()
public void setDeathSoundPitch(float pitch)
pitch
- The pitch the death sound should play withCopyright © 2020. All rights reserved.