Package com.velocitypowered.api.event
Interface EventHandler<E>
- Type Parameters:
E- the event type this handler accepts
- All Known Subinterfaces:
AwaitingEventExecutor<E>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents an interface to perform direct dispatch of an event. This makes integration easier to
achieve with platforms such as RxJava. While this interface can be used to implement an awaiting
event handler,
AwaitingEventExecutor provides a more idiomatic means to doing so.-
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes this handler synchronously with the given event.default @Nullable EventTaskexecuteAsync(E event) Executes this handler asynchronously with the given event.
-
Method Details
-
execute
Executes this handler synchronously with the given event.- Parameters:
event- the event to handle
-
executeAsync
Executes this handler asynchronously with the given event.If asynchronous handling is not implemented, the event is executed synchronously and this method returns
null.- Parameters:
event- the event to handle- Returns:
- an
EventTaskrepresenting the async task, ornullif not async
-