Package org.teleight.teleightbots.event
Interface EventListener.Builder<T extends Event>
- Type Parameters:
T- The type of event that theEventListenerbeing 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 Summary
Modifier and TypeMethodDescription@NotNull EventListener<T> build()Builds and returns theEventListenerinstance configured with the specified settings.@NotNull EventListener.Builder<T> expireCount(int expireCount) Sets the number of times an event can expire before it is no longer handled.@NotNull EventListener.Builder<T> Sets a filter for the builder to determine which events should be processed.@NotNull EventListener.Builder<T> Sets the handler for the builder to process events.@NotNull EventListener.Builder<T> ignoreCancelled(boolean ignoreCancelled) Configures whether the builder should ignore events that have been canceled.
-
Method Details
-
filter
Sets a filter for the builder to determine which events should be processed.- Parameters:
filter- ThePredicateused to filter events.- Returns:
- The current Builder instance.
-
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
Sets the handler for the builder to process events.- Parameters:
handler- TheConsumerthat processes the events.- Returns:
- The current Builder instance.
-
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
Builds and returns theEventListenerinstance configured with the specified settings.- Returns:
- A new
EventListenerinstance with the configured properties.
-