Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- get()
- shutdown()
- getArgTypeById(String)
- broadcastArgCacheInvalidation(String...)
- getCommandRegistration()
- registerCommands()
- createVirtualPermissionGroups()
- registerSystemCommand(AbstractCommand)
- register(AbstractCommand)
- buildCommandTree(CommandSender)
- resolveCommand(String)
- suggestCompletions(CommandSender, List, int)
- handleCommand(CommandSender, String)
- handleCommands(CommandSender, Deque)
- getName()
Class CommandManager
java.lang.Object
com.hypixel.hytale.server.core.command.system.CommandManager
- All Implemented Interfaces:
CommandOwner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastArgCacheInvalidation(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.buildCommandTree(CommandSender sender) Builds the full command tree packet for a specific sender, filtering out commands the sender lacks permission for.Creates virtual permission groups by aggregating permissions from all registered commands.static CommandManagerget()ArgumentType<?> getArgTypeById(String typeId) Looks up the argument type registered for a given suggestion type ID.getName()handleCommand(CommandSender commandSender, String commandString) Parses and executes a command string on behalf of a sender.handleCommands(CommandSender sender, Deque<String> commands) Executes a queue of commands sequentially, each starting after the previous completes.register(AbstractCommand command) Registers a command, making it available for execution and autocomplete.voidRegisters all built-in (core server) commands.voidregisterSystemCommand(AbstractCommand command) Registers a command owned by the core server itself (as opposed to a plugin).resolveCommand(String name) Resolves a command by name, falling back to the alias table.voidshutdown()suggestCompletions(CommandSender sender, List<String> words, int wordIndex) Resolves autocomplete suggestions for a partially typed command line, used by the server console completer.
-
Constructor Details
-
CommandManager
public CommandManager()
-
-
Method Details
-
get
-
shutdown
public void shutdown() -
getArgTypeById
Looks up the argument type registered for a given suggestion type ID. Used by the network handler to serviceArgValuesRequestpackets from clients. -
broadcastArgCacheInvalidation
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
-
registerCommands
public void registerCommands()Registers all built-in (core server) commands. Plugin commands are registered separately viaregister(AbstractCommand). -
createVirtualPermissionGroups
-
registerSystemCommand
Registers a command owned by the core server itself (as opposed to a plugin). Sets theCommandOwnerto thisCommandManager, which means the command's auto-generated permissions are namespaced under "HytaleServer". Plugin commands should useCommandRegistry.registerCommand(AbstractCommand)instead, which assigns the plugin as owner.- Parameters:
command- TheAbstractCommandto register.
-
register
Registers a command, making it available for execution and autocomplete.- Parameters:
command- TheAbstractCommandto register. Must have a non-empty name.- Returns:
- The registration handle, or null if
completeRegistration()threw.
-
buildCommandTree
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
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
nullif 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.wordsare the whitespace-split tokens with the token under the cursor truncated to the text before the caret;wordIndexselects 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
- Specified by:
getNamein interfaceCommandOwner
-