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