Class EnchantEffectEvent

java.lang.Object
org.bukkit.event.Event
io.artificial.enchantments.api.event.EnchantEffectEvent
Direct Known Subclasses:
CombatEvent, ConsumableEvent, FishingEvent, InteractionEvent, ItemEvent, ProjectileEvent, TickEvent, ToolEvent, WeaponEvent

public abstract class EnchantEffectEvent extends org.bukkit.event.Event
Base class for all enchantment effect events dispatched through the event bus.

Events extend this class to provide type-specific data for different game scenarios (combat, tool usage, etc.). Each event carries the enchantment definition, level, and scaled value that triggered it.

Dispatch Order:
Events are dispatched after typed callbacks from EnchantmentEffectHandler. Both paths use the same dispatch spine for consistency.

Cancellation:
Subclasses that represent cancellable game events implement Cancellable. Check isCancellable() before calling checkCancelled().

Since:
0.1.0
See Also:
  • Nested Class Summary

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

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

    Constructors
    Modifier
    Constructor
    Description
    protected
    EnchantEffectEvent(boolean isAsync, @NotNull EnchantmentDefinition enchantment, int level, double scaledValue)
    Creates a new enchant effect event with async flag.
    protected
    EnchantEffectEvent(@NotNull EnchantmentDefinition enchantment, int level, double scaledValue)
    Creates a new enchant effect event.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this event has been cancelled.
    Gets the enchantment definition that triggered this event.
    static @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event type.
    abstract @NotNull org.bukkit.event.HandlerList
     
    int
    Gets the level of the triggering enchantment.
    double
    Gets the scaled value from the enchantment's scaling algorithm.
    boolean
    Checks if this event type is cancellable.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • EnchantEffectEvent

      protected EnchantEffectEvent(@NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue)
      Creates a new enchant effect event.
      Parameters:
      enchantment - the enchantment that triggered this event
      level - the level of the enchantment
      scaledValue - the scaled value from the enchantment's scaling algorithm
    • EnchantEffectEvent

      protected EnchantEffectEvent(boolean isAsync, @NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue)
      Creates a new enchant effect event with async flag.
      Parameters:
      isAsync - whether the event is async
      enchantment - the enchantment that triggered this event
      level - the level of the enchantment
      scaledValue - the scaled value from the enchantment's scaling algorithm
  • Method Details

    • getEnchantment

      @NotNull public @NotNull EnchantmentDefinition getEnchantment()
      Gets the enchantment definition that triggered this event.
      Returns:
      the enchantment definition
    • getLevel

      public int getLevel()
      Gets the level of the triggering enchantment.
      Returns:
      the enchantment level
    • getScaledValue

      public double getScaledValue()
      Gets the scaled value from the enchantment's scaling algorithm.
      Returns:
      the scaled value
    • isCancellable

      public boolean isCancellable()
      Checks if this event type is cancellable.
      Returns:
      true if this event implements Cancellable
    • checkCancelled

      public boolean checkCancelled()
      Checks if this event has been cancelled.
      Returns:
      true if cancelled
      Throws:
      IllegalStateException - if this event type is not cancellable
    • getHandlers

      @NotNull public abstract @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
      Gets the handler list for this event type.
      Returns:
      the handler list
      Throws:
      UnsupportedOperationException - if called on the base class