Package net.minestom.server.event
Class EventListener.Builder<T extends Event>
java.lang.Object
net.minestom.server.event.EventListener.Builder<T>
- Enclosing interface:
EventListener<T extends Event>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull EventListener
<T> build()
expireCount
(int expireCount) Removes this listener after it has been executed the given number of times.expireWhen
(Predicate<T> expireWhen) Expires this listener when it passes the given condition.Adds a filter to the executor of this listener.Sets the handler for this event listener.ignoreCancelled
(boolean ignoreCancelled) Specifies if the handler should still be called ifCancellableEvent.isCancelled()
returnstrue
.
-
Constructor Details
-
Builder
-
-
Method Details
-
filter
Adds a filter to the executor of this listener. The executor will only be called if this condition passes on the given event. -
ignoreCancelled
@Contract("_ -> this") @NotNull public EventListener.Builder<T> ignoreCancelled(boolean ignoreCancelled) Specifies if the handler should still be called ifCancellableEvent.isCancelled()
returnstrue
.Default is set to
true
.- Parameters:
ignoreCancelled
- True to stop processing the event when cancelled
-
expireCount
Removes this listener after it has been executed the given number of times.- Parameters:
expireCount
- The number of times to execute
-
expireWhen
Expires this listener when it passes the given condition. The expiration will happen before the event is executed.- Parameters:
expireWhen
- The condition to test
-
handler
Sets the handler for this event listener. This will be executed if the listener passes all conditions. -
build
-