From b28178b9155734fdd38b0f059bfdafd81d0289c0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 16 Aug 2022 17:12:27 +0200 Subject: [PATCH] Add better boolean handling for StaticValue annotation --- src/de/steamwar/command/SWCommandUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/command/SWCommandUtils.java b/src/de/steamwar/command/SWCommandUtils.java index 3cac23c..94a9c93 100644 --- a/src/de/steamwar/command/SWCommandUtils.java +++ b/src/de/steamwar/command/SWCommandUtils.java @@ -138,11 +138,11 @@ public class SWCommandUtils { if (staticValue.allowISE()) { if ((parameter.getType() == boolean.class || parameter.getType() == Boolean.class)) { List tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value())); - Set trueValues = new HashSet<>(); - for (int i : staticValue.falseValues()) trueValues.add(i); + Set falseValues = new HashSet<>(); + for (int i : staticValue.falseValues()) falseValues.add(i); return createMapper(s -> { int index = tabCompletes.indexOf(s); - return index == -1 ? null : !trueValues.contains(index); + return index == -1 ? null : !falseValues.contains(index); }, (commandSender, s) -> tabCompletes); } if ((parameter.getType() == int.class || parameter.getType() == Integer.class) && staticValue.value().length >= 2) {