Class EventBusDispatcher

java.lang.Object
io.artificial.enchantments.internal.EventBusDispatcher

public final class EventBusDispatcher extends Object
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:

The dispatcher extracts necessary data from the underlying Bukkit event to populate the EnchantEffectEvent with contextual information.

See Also:
  • Constructor Details

    • EventBusDispatcher

      public EventBusDispatcher(@NotNull @NotNull EnchantmentEventBus eventBus)
      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 definition
      context - the effect context
      bukkitEvent - the underlying Bukkit event
      eventType - the type of event being dispatched
      Returns:
      true if the event was cancelled during dispatch, false otherwise