Class CommandManager

java.lang.Object
com.hypixel.hytale.server.core.command.system.CommandManager
All Implemented Interfaces:
CommandOwner

public class CommandManager extends Object implements CommandOwner
  • Constructor Details

    • CommandManager

      public CommandManager()
  • Method Details

    • get

      public static CommandManager get()
    • shutdown

      public void shutdown()
    • getArgTypeById

      @Nullable public ArgumentType<?> getArgTypeById(@Nonnull String typeId)
      Looks up the argument type registered for a given suggestion type ID. Used by the network handler to service ArgValuesRequest packets from clients.
    • broadcastArgCacheInvalidation

      public void broadcastArgCacheInvalidation(@Nonnull String... argTypeIds)
      Tells all connected clients to invalidate their cached suggestion values for the given arg type IDs, forcing them to re-fetch on next autocomplete.
    • getCommandRegistration

      @Nonnull public Map<String, AbstractCommand> getCommandRegistration()
    • registerCommands

      public void registerCommands()
      Registers all built-in (core server) commands. Plugin commands are registered separately via register(AbstractCommand).
    • createVirtualPermissionGroups

      public Map<String, Set<String>> createVirtualPermissionGroups()
      Creates virtual permission groups by aggregating permissions from all registered commands.
      Returns:
      A map where keys are permission group names and values are sets of permissions associated with those groups.
    • registerSystemCommand

      public void registerSystemCommand(@Nonnull AbstractCommand command)
      Registers a command owned by the core server itself (as opposed to a plugin). Sets the CommandOwner to this CommandManager, which means the command's auto-generated permissions are namespaced under "HytaleServer". Plugin commands should use CommandRegistry.registerCommand(AbstractCommand) instead, which assigns the plugin as owner.
      Parameters:
      command - The AbstractCommand to register.
    • register

      @Nullable public CommandRegistration register(@Nonnull AbstractCommand command)
      Registers a command, making it available for execution and autocomplete.
      Parameters:
      command - The AbstractCommand to register. Must have a non-empty name.
      Returns:
      The registration handle, or null if completeRegistration() threw.
    • buildCommandTree

      @Nonnull public CommandTreeSync buildCommandTree(@Nonnull CommandSender sender)
      Builds the full command tree packet for a specific sender, filtering out commands the sender lacks permission for. Sent to clients on connect and permission changes.
    • resolveCommand

      @Nullable public AbstractCommand resolveCommand(@Nonnull String name)
      Resolves a command by name, falling back to the alias table. The name is expected to be lower-cased by the caller, matching how commands and aliases are registered.
      Parameters:
      name - the command name or alias.
      Returns:
      the matching command, or null if none is registered.
    • suggestCompletions

      @Nonnull public List<String> suggestCompletions(@Nonnull CommandSender sender, @Nonnull List<String> words, int wordIndex)
      Resolves autocomplete suggestions for a partially typed command line, used by the server console completer. words are the whitespace-split tokens with the token under the cursor truncated to the text before the caret; wordIndex selects which token to complete.
    • handleCommand

      @Nonnull public CompletableFuture<Void> handleCommand(@Nonnull CommandSender commandSender, @Nonnull String commandString)
      Parses and executes a command string on behalf of a sender. Runs asynchronously on the common pool; the returned future completes when execution finishes.
    • handleCommands

      @Nonnull public CompletableFuture<Void> handleCommands(@Nonnull CommandSender sender, @Nonnull Deque<String> commands)
      Executes a queue of commands sequentially, each starting after the previous completes.
    • getName

      @Nonnull public String getName()
      Specified by:
      getName in interface CommandOwner