Class EntityDamageEvent
java.lang.Object
net.minestom.server.event.entity.EntityDamageEvent
- All Implemented Interfaces:
Event, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent
-
Constructor Summary
ConstructorsConstructorDescriptionEntityDamageEvent(LivingEntity entity, Damage damage, @Nullable SoundEvent sound) -
Method Summary
Modifier and TypeMethodDescriptionGets the damage type.Gets the entity of this event.getSound()Gets the damage sound.booleanGets if theEventshould be cancelled or not.voidsetAnimation(boolean animation) Sets whether the damage animation should be played.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidsetSound(@Nullable SoundEvent sound) Changes the damage sound.booleanGets whether the damage animation should be played.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EntityInstanceEvent
getInstance
-
Constructor Details
-
EntityDamageEvent
-
-
Method Details
-
getEntity
Description copied from interface:EntityEventGets the entity of this event.- Specified by:
getEntityin interfaceEntityEvent- Returns:
- the entity
-
getDamage
-
getSound
-
setSound
Changes the damage sound.- Parameters:
sound- the new damage sound
-
shouldAnimate
public boolean shouldAnimate()Gets whether the damage animation should be played.- Returns:
- true if the animation should be played
-
setAnimation
public void setAnimation(boolean animation) Sets whether the damage animation should be played.- Parameters:
animation- whether the animation should be played or not
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableEventGets if theEventshould be cancelled or not.- Specified by:
isCancelledin interfaceCancellableEvent- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEventMarks theEventas cancelled or not.- Specified by:
setCancelledin interfaceCancellableEvent- Parameters:
cancel- true if the event should be cancelled, false otherwise
-