From eb7eb15ee7b2abf782247f3ee9ed132c922ca09a Mon Sep 17 00:00:00 2001 From: Glare Date: Fri, 21 May 2021 19:23:54 -0500 Subject: [PATCH] Implemented tab completion for `/plot help` (#3053) Co-authored-by: NotMyFault --- .../java/com/plotsquared/core/command/Help.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/command/Help.java b/Core/src/main/java/com/plotsquared/core/command/Help.java index e59fc2742..a329d74ec 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Help.java +++ b/Core/src/main/java/com/plotsquared/core/command/Help.java @@ -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 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()); + } + }