Class CommandCompletion

java.lang.Object
com.hypixel.hytale.server.core.command.system.CommandCompletion

public final class CommandCompletion extends Object
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 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 at wordIndex.
      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 into words of the token being completed.
      Returns:
      the suggested completions for that token, deduplicated and in suggestion order.