Implemented tab completion for /plot help (#3053)

Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
Glare 2021-05-21 19:23:54 -05:00 committed by GitHub
parent a17085bb18
commit eb7eb15ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,11 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.Template;
import java.util.Collection;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@CommandDeclaration(command = "help",
aliases = "?",
@ -144,4 +148,13 @@ public class Help extends Command {
});
}
@Override
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
return Stream.of("claiming", "teleport", "settings", "chat", "schematic", "appearance", "info", "debug",
"administration", "all")
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "", RequiredType.NONE, null) {
}).collect(Collectors.toList());
}
}