Optimize SWCommand
Dieser Commit ist enthalten in:
Ursprung
259d6fef99
Commit
ee9f9d40ce
@ -60,13 +60,14 @@ public abstract class SWCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
||||||
|
String string = args[args.length - 1].toLowerCase();
|
||||||
return commandList.stream()
|
return commandList.stream()
|
||||||
.map(s -> s.tabComplete(sender, args))
|
.map(s -> s.tabComplete(sender, args))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.filter(s -> !s.isEmpty())
|
.filter(s -> !s.isEmpty())
|
||||||
.filter(s -> !s.isBlank())
|
.filter(s -> !s.isBlank())
|
||||||
.filter(s -> s.toLowerCase().startsWith(args[args.length - 1].toLowerCase()))
|
.filter(s -> s.toLowerCase().startsWith(string))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren