Class EventBusDispatcher
java.lang.Object
io.artificial.enchantments.internal.EventBusDispatcher
Dispatches effects through the event bus to registered listeners.
This dispatcher creates the appropriate EnchantEffectEvent subclass
and dispatches it via the EnchantmentEventBus. It is called by the
EffectDispatchSpine as the second path in the dual-path dispatch system.
Event creation mapping:
- Combat events →
CombatEvent - Tool events (block break/place) →
ToolEvent - Interaction events →
InteractionEvent - Projectile events →
ProjectileEvent - Fishing events →
FishingEvent - Tick events →
TickEvent - Item events →
ItemEvent - Consumable events →
ConsumableEvent - Weapon events →
WeaponEvent
The dispatcher extracts necessary data from the underlying Bukkit event to populate the EnchantEffectEvent with contextual information.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEventBusDispatcher(@NotNull EnchantmentEventBus eventBus) Creates a new EventBusDispatcher. -
Method Summary
Modifier and TypeMethodDescriptionbooleandispatch(@NotNull EnchantmentDefinition enchantment, @NotNull EffectContext context, @NotNull org.bukkit.event.Event bukkitEvent, EffectDispatchSpine.DispatchEventType eventType) Dispatches an effect through the event bus.
-
Constructor Details
-
EventBusDispatcher
Creates a new EventBusDispatcher.- Parameters:
eventBus- the event bus to dispatch events through
-
-
Method Details
-
dispatch
public boolean dispatch(@NotNull @NotNull EnchantmentDefinition enchantment, @NotNull @NotNull EffectContext context, @NotNull @NotNull org.bukkit.event.Event bukkitEvent, @NotNull EffectDispatchSpine.DispatchEventType eventType) Dispatches an effect through the event bus.- Parameters:
enchantment- the enchantment definitioncontext- the effect contextbukkitEvent- the underlying Bukkit eventeventType- the type of event being dispatched- Returns:
- true if the event was cancelled during dispatch, false otherwise
-