Class EntityAttributeModifierAddEvent

java.lang.Object
org.bukkit.event.Event
com.github.darksoulq.abyssallib.server.event.custom.entity.EntityAttributeModifierAddEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class EntityAttributeModifierAddEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
An event called when a new modifier is added to an entity's attribute. This event is Cancellable, allowing listeners to prevent the modifier from being applied or to swap the modifier for a different one.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntityAttributeModifierAddEvent(@NotNull org.bukkit.entity.Entity entity, @NotNull Attribute attribute, @NotNull AttributeModifier modifier)
    Constructs a new EntityAttributeModifierAddEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Attribute
    Retrieves the specific attribute that the modifier is being applied to.
    @NotNull org.bukkit.entity.Entity
    Retrieves the entity involved in this event.
    static org.bukkit.event.HandlerList
    Provides a static method to retrieve the handler list, required by Bukkit.
    @NotNull org.bukkit.event.HandlerList
    Retrieves the list of handlers listening to this event instance.
    Retrieves the current modifier object that is proposed to be added.
    boolean
    Checks if the addition of the modifier has been cancelled.
    void
    setCancelled(boolean v)
    Sets the cancellation state of the event.
    void
    setModifier(@NotNull AttributeModifier modifier)
    Sets a new modifier object to be added instead of the original one.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntityAttributeModifierAddEvent

      public EntityAttributeModifierAddEvent(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Attribute attribute, @NotNull @NotNull AttributeModifier modifier)
      Constructs a new EntityAttributeModifierAddEvent.
      Parameters:
      entity - The Entity receiving the modifier.
      attribute - The Attribute instance being modified.
      modifier - The AttributeModifier object to be added.
  • Method Details

    • getEntity

      @NotNull public @NotNull org.bukkit.entity.Entity getEntity()
      Retrieves the entity involved in this event.
      Returns:
      The Entity receiving the modifier.
    • getAttribute

      @NotNull public @NotNull Attribute getAttribute()
      Retrieves the specific attribute that the modifier is being applied to.
      Returns:
      The Attribute definition.
    • getModifier

      @NotNull public @NotNull AttributeModifier getModifier()
      Retrieves the current modifier object that is proposed to be added.
      Returns:
      The AttributeModifier instance.
    • setModifier

      public void setModifier(@NotNull @NotNull AttributeModifier modifier)
      Sets a new modifier object to be added instead of the original one.
      Parameters:
      modifier - The replacement AttributeModifier instance.
    • isCancelled

      public boolean isCancelled()
      Checks if the addition of the modifier has been cancelled.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      True if the event is cancelled.
    • setCancelled

      public void setCancelled(boolean v)
      Sets the cancellation state of the event.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      v - True to prevent the modifier from being added.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Retrieves the list of handlers listening to this event instance.
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      The HandlerList for this event.
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Provides a static method to retrieve the handler list, required by Bukkit.
      Returns:
      The static HandlerList for this event type.