Merge pull request 'Update SWCommandUtils and shorten the methods' (#163) from SWCommandUtilsShortening into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #163 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
9f78734f86
@ -162,41 +162,26 @@ public class SWCommandUtils {
|
|||||||
return createMapper(staticValue.value());
|
return createMapper(staticValue.value());
|
||||||
}
|
}
|
||||||
if (staticValue.allowISE()) {
|
if (staticValue.allowISE()) {
|
||||||
if (parameter.getType() == boolean.class && staticValue.value().length == 2) {
|
if ((parameter.getType() == boolean.class || parameter.getType() == Boolean.class) && staticValue.value().length == 2) {
|
||||||
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
||||||
return new TypeMapper<Boolean>() {
|
return createMapper(s -> {
|
||||||
@Override
|
int index = tabCompletes.indexOf(s);
|
||||||
public Boolean map(CommandSender commandSender, String[] previousArguments, String s) {
|
return index == -1 ? null : index != 0;
|
||||||
int index = tabCompletes.indexOf(s);
|
}, (commandSender, s) -> tabCompletes);
|
||||||
if (index == -1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return index != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s) {
|
|
||||||
return tabCompletes;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
if (parameter.getType() == int.class && staticValue.value().length >= 2) {
|
if ((parameter.getType() == int.class || parameter.getType() == Integer.class) && staticValue.value().length >= 2) {
|
||||||
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
||||||
return new TypeMapper<Integer>() {
|
return createMapper(s -> {
|
||||||
@Override
|
int index = tabCompletes.indexOf(s);
|
||||||
public Integer map(CommandSender commandSender, String[] previousArguments, String s) {
|
return index == -1 ? null : index;
|
||||||
int index = tabCompletes.indexOf(s);
|
}, (commandSender, s) -> tabCompletes);
|
||||||
if (index == -1) {
|
}
|
||||||
return null;
|
if ((parameter.getType() == long.class || parameter.getType() == Long.class) && staticValue.value().length >= 2) {
|
||||||
}
|
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
|
||||||
return index;
|
return createMapper(s -> {
|
||||||
}
|
long index = tabCompletes.indexOf(s);
|
||||||
|
return index == -1 ? null : index;
|
||||||
@Override
|
}, (commandSender, s) -> tabCompletes);
|
||||||
public List<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s) {
|
|
||||||
return tabCompletes;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren