Interface EventListener.Builder<T extends Event>

Type Parameters:
T - The type of event that the EventListener being built will handle.
Enclosing interface:
EventListener<T extends Event>

public static sealed interface EventListener.Builder<T extends Event>
Builder interface for constructing EventListener instances.
  • Method Details

    • filter

      @NotNull @NotNull EventListener.Builder<T> filter(@NotNull @NotNull Predicate<T> filter)
      Sets a filter for the builder to determine which events should be processed.
      Parameters:
      filter - The Predicate used to filter events.
      Returns:
      The current Builder instance.
    • ignoreCancelled

      @NotNull @NotNull EventListener.Builder<T> ignoreCancelled(boolean ignoreCancelled)
      Configures whether the builder should ignore events that have been canceled.
      Parameters:
      ignoreCancelled - Whether to ignore canceled events.
      Returns:
      The current Builder instance.
    • handler

      @NotNull @NotNull EventListener.Builder<T> handler(@NotNull @NotNull Consumer<T> handler)
      Sets the handler for the builder to process events.
      Parameters:
      handler - The Consumer that processes the events.
      Returns:
      The current Builder instance.
    • expireCount

      @NotNull @NotNull EventListener.Builder<T> expireCount(int expireCount)
      Sets the number of times an event can expire before it is no longer handled.

      Expiry count determines how many times an event can be considered expired before it is discarded and marked as EXPIRED.

      Parameters:
      expireCount - The number of times an event can expire.
      Returns:
      The current Builder instance.
    • build

      @NotNull @NotNull EventListener<T> build()
      Builds and returns the EventListener instance configured with the specified settings.
      Returns:
      A new EventListener instance with the configured properties.