Contents
Class CommandCompletion
java.lang.Object
com.hypixel.hytale.server.core.command.system.CommandCompletion
Resolves autocomplete suggestions for a partially typed command line.
The in-game client performs the equivalent resolution itself off the CommandTreeSync
packet. This is the server-local counterpart so the console can complete commands and arguments
without a networked client. It reuses the same resolution primitives as command execution
(CommandManager.resolveCommand(String) for the root command and AbstractCommand.getSubCommand(String)
for subcommand descent) and the same per-argument Argument.getSuggestions(CommandSender, String[]) providers
that drive client autocomplete; only the partial-line walk is specific to completion.
-
Method Summary
Modifier and TypeMethodDescriptionsuggest(CommandSender sender, Collection<AbstractCommand> allCommands, Function<String, AbstractCommand> commandResolver, List<String> words, int wordIndex) Resolves the suggestions for the token atwordIndex.
-
Method Details
-
suggest
@Nonnull public static List<String> suggest(@Nonnull CommandSender sender, @Nonnull Collection<AbstractCommand> allCommands, @Nonnull Function<String, AbstractCommand> commandResolver, @Nonnull List<String> words, int wordIndex) Resolves the suggestions for the token atwordIndex.- Parameters:
sender- the sender requesting completion; used for permission filtering and value suggestions.allCommands- every registered top-level command, used to complete the command name itself.commandResolver- resolves a (lower-cased) command name or alias to its command, shared with execution.words- the whitespace-split tokens of the line, with the token under the cursor truncated to the text before the caret.wordIndex- the index intowordsof the token being completed.- Returns:
- the suggested completions for that token, deduplicated and in suggestion order.
-