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
ConstructorsModifierConstructorDescriptionprotectedEnchantEffectEvent(boolean isAsync, @NotNull EnchantmentDefinition enchantment, int level, double scaledValue) Creates a new enchant effect event with async flag.protectedEnchantEffectEvent(@NotNull EnchantmentDefinition enchantment, int level, double scaledValue) Creates a new enchant effect event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this event has been cancelled.@NotNull EnchantmentDefinitionGets the enchantment definition that triggered this event.static @NotNull org.bukkit.event.HandlerListGets the handler list for this event type.abstract @NotNull org.bukkit.event.HandlerListintgetLevel()Gets the level of the triggering enchantment.doubleGets the scaled value from the enchantment's scaling algorithm.booleanChecks if this event type is cancellable.Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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 eventlevel- the level of the enchantmentscaledValue- 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 asyncenchantment- the enchantment that triggered this eventlevel- the level of the enchantmentscaledValue- the scaled value from the enchantment's scaling algorithm
-
-
Method Details
-
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:
getHandlersin classorg.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
-