Class EntityDamageEvent

java.lang.Object
net.minestom.server.event.entity.EntityDamageEvent
All Implemented Interfaces:
Event, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent

public class EntityDamageEvent extends Object implements EntityInstanceEvent, CancellableEvent
  • Constructor Details

    • EntityDamageEvent

      public EntityDamageEvent(@NotNull @NotNull LivingEntity entity, @NotNull @NotNull Damage damage, @Nullable @Nullable SoundEvent sound)
  • Method Details

    • getEntity

      @NotNull public @NotNull LivingEntity getEntity()
      Description copied from interface: EntityEvent
      Gets the entity of this event.
      Specified by:
      getEntity in interface EntityEvent
      Returns:
      the entity
    • getDamage

      @NotNull public @NotNull Damage getDamage()
      Gets the damage type.
      Returns:
      the damage type
    • getSound

      @Nullable public @Nullable SoundEvent getSound()
      Gets the damage sound.
      Returns:
      the damage sound
    • setSound

      public void setSound(@Nullable @Nullable SoundEvent sound)
      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: CancellableEvent
      Gets if the Event should be cancelled or not.
      Specified by:
      isCancelled in interface CancellableEvent
      Returns:
      true if the event should be cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: CancellableEvent
      Marks the Event as cancelled or not.
      Specified by:
      setCancelled in interface CancellableEvent
      Parameters:
      cancel - true if the event should be cancelled, false otherwise