CommandManager is a singleton object that manages LiquidBounce’s command system. It handles command registration, execution, parsing, and autocompletion.
Object Declaration
Collection<Command>, providing access to all registered commands through standard collection operations.
Global Settings
Prefix
The command prefix used to invoke commands.The prefix character(s) required before command names
Hint Count
Number of suggestions to show for unknown commands.How many command suggestions to display when an unknown command is entered
Methods
registerInbuilt()
Registers all built-in LiquidBounce commands.CommandClient- Client managementCommandFriend- Friend list managementCommandToggle- Module togglingCommandBind- Keybind management- And many more…
addCommand()
Adds a new command to the registry.The command instance to register
IllegalStateException if a command with the same name already exists
Example:
removeCommand()
Removes a command from the registry.The command instance to unregister
IllegalStateException if the command doesn’t exist
execute()
Executes a command from a string input.The full command string to execute (including prefix)
CommandException for various error conditions:
- Unknown command
- Invalid usage
- Missing required parameters
- Invalid parameter values
tokenizeCommand()
Tokenizes a command string into arguments and their positions.The command line to tokenize
A pair containing:
- First: List of tokenized arguments
- Second: List of starting indices for each token
- Handles quoted strings with spaces
- Supports escape characters ()
- Preserves unclosed quotes in output
autoComplete()
Provides autocompletion suggestions for command input.The original command string being typed
The cursor position in the command
A future containing autocompletion suggestions based on registered commands and their parameters
- Suggests command names based on prefix matching
- Suggests subcommands when appropriate
- Delegates to parameter autocompletion handlers
- Uses case-insensitive matching
Internal Data Structures
Root Command Map
A case-insensitive sorted map for fast command lookup.- Key: Command name or alias
- Value: Command instance
- Order: Case-insensitive alphabetical
Command Set
A sorted set of all registered commands.Error Handling
CommandManager usesCommandException for error reporting with helpful hints:
- Calculates Levenshtein distance to all commands
- Returns the closest matches (up to
hintCount) - Displays suggestions with aliases
Usage Examples
Checking if a Command Exists
Iterating All Commands
Getting Command Count
Script API Access
Theexecute() method is marked with @ScriptApiRequired, making it accessible from scripts:
Built-in Command Categories
Commands registered byregisterInbuilt() include:
Client Commands:
CommandClient- Client settingsCommandConfig- Configuration managementCommandScript- Script managementCommandMarketplace- Marketplace access
CommandToggle- Module controlCommandBind- KeybindingCommandPanic- Emergency module disableCommandValue- Module setting adjustment
CommandFriend- Friend managementCommandTargets- Target management
CommandPing- Server pingCommandTps- Server TPSCommandServerInfo- Server informationCommandCoordinates- Position display
CommandItemGive- Item spawningCommandItemRename- Item renamingCommandItemEnchant- Item enchantingCommandItemStack- Stack manipulation
CommandFakePlayer- Fake player spawningCommandTeleport- TeleportationCommandVClip- Vertical clippingCommandRemoteView- Remote viewing
See Also
- Command Class - Command structure and API
- Creating Commands - Guide to building custom commands
- Script API - Using commands in scripts