Package eu.sculkpowered.server.event
Interface EventHandler
public interface EventHandler
Handles the registration and execution of events.
-
Method Summary
Modifier and TypeMethodDescription<E> CompletableFuture
<E> call
(E event) Calls the event.<E> void
justCall
(E event) Calls the event.<E> void
register
(@NotNull Plugin plugin, @NotNull Class<E> event, short eventOrder, @NotNull Consumer<E> eventConsumer) Registers an event listener consumer.default <E> void
Registers an event listener consumer.void
Registers the event listener.void
unregister
(@NotNull Plugin plugin) Unregisters all listeners of a specific pluginvoid
unregister
(@NotNull Plugin plugin, @NotNull Object listener) Unregisters the specified listener.
-
Method Details
-
register
Registers the event listener.- Parameters:
plugin
- the plugin that registers the event listenerlistener
- the listener- Since:
- 1.0.0
-
register
default <E> void register(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Class<E> event, @NotNull @NotNull Consumer<E> eventConsumer) Registers an event listener consumer.- Type Parameters:
E
- the event class type- Parameters:
plugin
- the plugin that registers the event listenerevent
- the event classeventConsumer
- the consumer that consumes the event on call- Since:
- 1.0.0
-
register
<E> void register(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Class<E> event, short eventOrder, @NotNull @NotNull Consumer<E> eventConsumer) Registers an event listener consumer.- Type Parameters:
E
- the event class type- Parameters:
plugin
- the plugin that registers the event listenerevent
- the event classeventOrder
- the ordereventConsumer
- the consumer that consumes the event on call- Since:
- 1.0.0
-
unregister
Unregisters all listeners of a specific plugin- Parameters:
plugin
- the plugin of the listeners- Since:
- 1.0.0
-
unregister
Unregisters the specified listener.- Parameters:
plugin
- the plugin of the listenerlistener
- the listener to unregister- Since:
- 1.0.0
-
call
Calls the event.- Type Parameters:
E
- the event type to call- Parameters:
event
- the event to call- Returns:
- a
CompletableFuture
with the called event. - Since:
- 1.0.0
-
justCall
<E> void justCall(E event) Calls the event.- Type Parameters:
E
- the event type to call- Parameters:
event
- the event to call- Since:
- 1.0.0
-