Command class represents a command in LiquidBounce’s command system. Commands can have subcommands, parameters, aliases, and custom handlers.
Class Signature
Properties
The primary name of the command
Alternative names that can be used to invoke the command
List of parameters the command accepts. See Parameter API for details.
Nested commands that can be executed as part of this command
Whether the command can be executed directly or is just a hub for subcommands
The function that executes when the command is invoked
Whether the command requires the player to be in-game
Reference to the parent command if this is a subcommand
Methods
usage()
Returns the formatted usage information for the command.A list of formatted usage components showing how to use the command and its subcommands
nameAsText()
Returns the command name as a formatted text component with hover description.Text component with the command name and hover tooltip showing description
result()
Creates a translated result message for the command.Translation key suffix (will be prefixed with command’s translation base)
Arguments to pass to the translation
Translated and formatted text component
printStyledText()
Sends a styled command result with copyable content.Translation key for the result message
Optional data to display and copy
Function to apply formatting to the text (default: regular)
Custom hover event (defaults to “Click to copy” tooltip)
Custom click action (defaults to copy to clipboard)
autoComplete()
Provides autocompletion suggestions for the command.The builder to add suggestions to
Tokenized command input and token positions
Current position in the command hierarchy
Whether we’re starting a new parameter
Handler Interface
The command handler interface that processes command execution.The command being executed
Parsed arguments passed to the command
Factory Interface
Provides a command to the CommandManager.Usage Example
From the source code, here’s how commands are structured:Translation Keys
Each command uses a translation base key:See Also
- CommandManager - Managing and executing commands
- Parameter Class - Command parameter reference
- Building Commands - Guide to creating custom commands