From 13350d0ab86dba84821bbeec8657f212e73912d7 Mon Sep 17 00:00:00 2001 From: TheMode Date: Wed, 9 Jun 2021 22:01:46 +0200 Subject: [PATCH] Fix ignoreCancelled option --- .../java/net/minestom/server/event/EventListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/event/EventListener.java b/src/main/java/net/minestom/server/event/EventListener.java index 8dc085ed9..ee70640fb 100644 --- a/src/main/java/net/minestom/server/event/EventListener.java +++ b/src/main/java/net/minestom/server/event/EventListener.java @@ -56,7 +56,7 @@ public interface EventListener { class Builder { private final Class eventType; private final List> filters = new ArrayList<>(); - private boolean ignoreCancelled; + private boolean ignoreCancelled = true; private int expireCount; private Predicate expireWhen; private Consumer handler; @@ -78,9 +78,9 @@ public interface EventListener { /** * Specifies if the handler should still be called if {@link CancellableEvent#isCancelled()} returns {@code true}. *

- * Default is set to {@code false}. + * Default is set to {@code true}. * - * @param ignoreCancelled True to still process the event when cancelled + * @param ignoreCancelled True to stop processing the event when cancelled */ @Contract(value = "_ -> this") public @NotNull EventListener.Builder ignoreCancelled(boolean ignoreCancelled) { @@ -140,7 +140,7 @@ public interface EventListener { @Override public @NotNull Result run(@NotNull T event) { // Event cancellation - if (!ignoreCancelled && event instanceof CancellableEvent && + if (ignoreCancelled && event instanceof CancellableEvent && ((CancellableEvent) event).isCancelled()) { return Result.INVALID; }