Package org.geysermc.geyser.event
Class EventManager
java.lang.Object
org.geysermc.geyser.event.EventManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionMap<Object,ArrayList<EventHandler<?>>>
Map<Class<? extends GeyserEvent>,PriorityBlockingQueue<EventHandler<?>>>
static EventManager
<T extends GeyserEvent>
LambdaEventHandler<T>on(Class<T> cls, BiConsumer<T,EventHandler<T>> consumer)
<T extends GeyserEvent>
LambdaEventHandler<T>Create a new EventHandler using a Lambda<T extends GeyserEvent>
voidregister(EventHandler<T> handler)
Register an EventHandlervoid
registerEvents(Object obj)
Register all Events contained in an instantiated class.<T extends GeyserEvent>
EventResult<T>triggerEvent(T event)
Trigger a new event.<T extends GeyserEvent>
voidunregister(EventHandler<T> handler)
Unregister an EventHandlervoid
unregisterEvents(Object obj)
Unregister all events in class
-
Constructor Details
-
EventManager
-
-
Method Details
-
triggerEvent
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
Create a new EventHandler using a Lambda- Parameters:
cls
- event classconsumer
- 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
Register an EventHandler- Parameters:
handler
- EventHandler to register
-
unregister
Unregister an EventHandler- Parameters:
handler
- EventHandler to unregister
-
registerEvents
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
Unregister all events in class -
getEventHandlers
-
getClassEventHandlers
-
getInstance
-