From 9f7eb9bcf557490604a397f52e218c6b7c6a53a1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 10 Jan 2018 19:44:26 -0500 Subject: [PATCH] Condition handlers wasnt meant to return boolean. Sorry if anyone wrote one already, remove the return type please. Really don't want to bump version when very low chance anyones using this system yet. --- .../java/co/aikar/commands/CommandConditions.java | 12 ++++-------- .../main/java/co/aikar/acfexample/ACFExample.java | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/co/aikar/commands/CommandConditions.java b/core/src/main/java/co/aikar/commands/CommandConditions.java index 50325291..f270b1f3 100644 --- a/core/src/main/java/co/aikar/commands/CommandConditions.java +++ b/core/src/main/java/co/aikar/commands/CommandConditions.java @@ -97,9 +97,7 @@ public class CommandConditions < //noinspection unchecked CC conditionContext = (CC) this.manager.createConditionContext(issuer, config); //noinspection unchecked - if (!condition.validateCondition(conditionContext)) { - return; - } + condition.validateCondition(conditionContext); } } @@ -134,17 +132,15 @@ public class CommandConditions < CC conditionContext = (CC) this.manager.createConditionContext(issuer, config); //noinspection unchecked - if (!condition.validateCondition(conditionContext, execContext, value)) { - return; - } + condition.validateCondition(conditionContext, execContext, value); } } public interface Condition { - boolean validateCondition(ConditionContext context) throws InvalidCommandArgument; + void validateCondition(ConditionContext context) throws InvalidCommandArgument; } public interface ParameterCondition { - boolean validateCondition(ConditionContext context, CEC execContext, P value) throws InvalidCommandArgument; + void validateCondition(ConditionContext context, CEC execContext, P value) throws InvalidCommandArgument; } } diff --git a/example/src/main/java/co/aikar/acfexample/ACFExample.java b/example/src/main/java/co/aikar/acfexample/ACFExample.java index 9a6841e4..a4bd7a97 100644 --- a/example/src/main/java/co/aikar/acfexample/ACFExample.java +++ b/example/src/main/java/co/aikar/acfexample/ACFExample.java @@ -68,7 +68,7 @@ public final class ACFExample extends JavaPlugin { // 5: Register Command Conditions commandManager.getCommandConditions().addCondition(SomeObject.class, "limits", (c, exec, value) -> { if (value == null) { - return true; + return; } if (c.hasConfig("min") && c.getConfigValue("min", 0) > value.getValue()) { throw new ConditionFailedException("Min value must be " + c.getConfigValue("min", 0)); @@ -76,7 +76,6 @@ public final class ACFExample extends JavaPlugin { if (c.hasConfig("max") && c.getConfigValue("max", 3) < value.getValue()) { throw new ConditionFailedException("Max value must be " + c.getConfigValue("max", 3)); } - return true; }); // 6: Register your commands - This first command demonstrates adding an exception handler to that command