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.

  • Method Details

    • eventType

      @NotNull @NotNull Class<T> eventType()
    • run

      @NotNull @NotNull EventListener.Result run(@NotNull T event)
    • 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 handle
      listener - The handler function
      Returns:
      An event listener with the given properties