public interface EventManager
Modifier and Type | Method and Description |
---|---|
<E> CompletableFuture<E> |
fire(E event)
Fires the specified event to the event bus asynchronously.
|
default void |
fireAndForget(Object event)
Posts the specified event to the event bus and discards the result.
|
default <E> void |
register(Object plugin,
Class<E> eventClass,
EventHandler<E> handler)
Requests that the specified
handler listen for events and associate it with the plugin . |
<E> void |
register(Object plugin,
Class<E> eventClass,
PostOrder postOrder,
EventHandler<E> handler)
Requests that the specified
handler listen for events and associate it with the plugin . |
void |
register(Object plugin,
Object listener)
Requests that the specified
listener listen for events and associate it with the plugin . |
<E> void |
unregister(Object plugin,
EventHandler<E> handler)
Unregisters a specific event handler for a specific plugin.
|
void |
unregisterListener(Object plugin,
Object listener)
Unregisters a specific listener for a specific plugin.
|
void |
unregisterListeners(Object plugin)
Unregisters all listeners for the specified
plugin . |
void register(Object plugin, Object listener)
listener
listen for events and associate it with the plugin
.plugin
- the plugin to associate with the listenerlistener
- the listener to registerdefault <E> void register(Object plugin, Class<E> eventClass, EventHandler<E> handler)
handler
listen for events and associate it with the plugin
.E
- the event type to handleplugin
- the plugin to associate with the handlereventClass
- the class for the event handler to registerhandler
- the handler to register<E> void register(Object plugin, Class<E> eventClass, PostOrder postOrder, EventHandler<E> handler)
handler
listen for events and associate it with the plugin
.E
- the event type to handleplugin
- the plugin to associate with the handlereventClass
- the class for the event handler to registerpostOrder
- the order in which events should be posted to the handlerhandler
- the handler to register<E> CompletableFuture<E> fire(E event)
event
- the event to fireCompletableFuture
representing the posted eventdefault void fireAndForget(Object event)
event
- the event to firevoid unregisterListeners(Object plugin)
plugin
.plugin
- the plugin to deregister listeners forvoid unregisterListener(Object plugin, Object listener)
plugin
- the plugin associated with the listenerlistener
- the listener to deregister<E> void unregister(Object plugin, EventHandler<E> handler)
E
- the event type to handleplugin
- the plugin to associate with the handlerhandler
- the handler to register