Add better boolean handling for StaticValue annotation #11
@ -138,11 +138,11 @@ public class SWCommandUtils {
|
||||
if (staticValue.allowISE()) {
|
||||
if ((parameter.getType() == boolean.class || parameter.getType() == Boolean.class)) {
|
||||
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
||||
Set<Integer> trueValues = new HashSet<>();
|
||||
for (int i : staticValue.falseValues()) trueValues.add(i);
|
||||
Set<Integer> 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) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren