Streamify SWCommand
Dieser Commit ist enthalten in:
Ursprung
a42188f7a0
Commit
06fb4bbc1a
@ -60,12 +60,10 @@ 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 {
|
||||||
List<String> strings = new ArrayList<>();
|
return commandList.stream()
|
||||||
for (SubCommand subCommand : commandList) {
|
.map(s -> s.tabComplete(sender, args))
|
||||||
List<String> tabCompletes = subCommand.tabComplete(sender, args);
|
.filter(Objects::nonNull)
|
||||||
if (tabCompletes != null) strings.addAll(tabCompletes);
|
.flatMap(Collection::stream)
|
||||||
}
|
|
||||||
return strings.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(args[args.length - 1].toLowerCase()))
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren