Package net.minestom.server.event
Interface EventListener<T extends Event>
- Type Parameters:
T
- The event type being handled.
public interface EventListener<T extends Event>
Represents an event listener (handler) in an event graph.
A listener is responsible for executing some action based on an event triggering.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
EventListener.Builder<T extends Event>
static enum
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Event>
@NotNull EventListener.Builder<T> static <T extends Event>
@NotNull EventListener<T> Create an event listener without any special options.@NotNull EventListener.Result
-
Method Details
-
eventType
-
run
-
builder
@Contract(pure=true) static <T extends Event> @NotNull EventListener.Builder<T> builder(@NotNull @NotNull Class<T> eventType) -
of
@Contract(pure=true) @NotNull static <T extends Event> @NotNull EventListener<T> of(@NotNull @NotNull Class<T> eventType, @NotNull @NotNull Consumer<@NotNull T> listener) Create an event listener without any special options. The given listener will be executed if the event passes all parent filtering.- Type Parameters:
T
- The event type to handle- Parameters:
eventType
- The event type to handlelistener
- The handler function- Returns:
- An event listener with the given properties
-