Class EventManager

java.lang.Object
org.geysermc.geyser.event.EventManager

public class EventManager extends Object
  • Constructor Details

    • EventManager

      public EventManager(GeyserImpl connector)
  • Method Details

    • triggerEvent

      public <T extends GeyserEvent> EventResult<T> triggerEvent(T event)
      Trigger a new event. All registered EventHandlers will be executed as long as they have the appropriate filter class (or none)
      Parameters:
      event - Event being triggered
      Returns:
      TriggerResult Result of the trigger
    • on

      public <T extends GeyserEvent> LambdaEventHandler<T> on(Class<T> cls, Consumer<T> consumer)
      Create a new EventHandler using a Lambda
      Parameters:
      cls - event class
      consumer - what to execute, passed an event
      Returns:
      an EventHandler
    • on

      public <T extends GeyserEvent> LambdaEventHandler<T> on(Class<T> cls, BiConsumer<T,​EventHandler<T>> consumer)
    • register

      public <T extends GeyserEvent> void register(EventHandler<T> handler)
      Register an EventHandler
      Parameters:
      handler - EventHandler to register
    • unregister

      public <T extends GeyserEvent> void unregister(EventHandler<T> handler)
      Unregister an EventHandler
      Parameters:
      handler - EventHandler to unregister
    • registerEvents

      public void registerEvents(Object obj)
      Register all Events contained in an instantiated class. The methods must be annotated by @GeyserEventHandler
      Parameters:
      obj - The class object to look for methods annotated by @GeyserEventHandlder
    • unregisterEvents

      public void unregisterEvents(Object obj)
      Unregister all events in class
    • getEventHandlers

      public Map<Class<? extends GeyserEvent>,​PriorityBlockingQueue<EventHandler<?>>> getEventHandlers()
    • getClassEventHandlers

      public Map<Object,​ArrayList<EventHandler<?>>> getClassEventHandlers()
    • getInstance

      public static EventManager getInstance()