Class EventHandler<T extends Event>

java.lang.Object
emu.grasscutter.server.event.EventHandler<T>

public final class EventHandler<T extends Event> extends Object
  • Constructor Details

    • EventHandler

      public EventHandler(Class<T> eventClass)
  • Method Details

    • handles

      public Class<T> handles()
      Gets which event this handler is handling.
      Returns:
      An event class.
    • getCallback

      public EventConsumer<T> getCallback()
      Returns the callback for the handler.
      Returns:
      A consumer callback.
    • getPriority

      public HandlerPriority getPriority()
      Returns the handler's priority.
      Returns:
      The priority of the handler.
    • ignoresCanceled

      public boolean ignoresCanceled()
      Returns if the handler will ignore cancelled events.
      Returns:
      The ignore cancelled state.
    • listener

      public EventHandler<T> listener(EventConsumer<T> listener)
      Sets the callback method for when the event is invoked.
      Parameters:
      listener - An event handler method.
      Returns:
      Method chaining.
    • priority

      public EventHandler<T> priority(HandlerPriority priority)
      Changes the handler's priority in handling events.
      Parameters:
      priority - The priority of the handler.
      Returns:
      Method chaining.
    • ignore

      public EventHandler<T> ignore(boolean ignore)
      Sets if the handler will ignore cancelled events.
      Parameters:
      ignore - If the handler should ignore cancelled events.
      Returns:
      Method chaining.
    • register

      public void register()
      Registers the handler into the PluginManager.