Overview
Minestom’s command system provides a powerful builder API for creating commands with auto-completion, argument parsing, and condition checking.CommandManager
Manager used to register and execute commands.Registration
Registers a commandThrows
IllegalStateException if a command with the same name already existsRemoves a command from registered commands
Gets a registered command by nameReturns
null if not foundChecks if a command exists
Execution
Executes a command for a CommandSender
Executes a command using a ServerSender (silent, nothing printed to console)
Callbacks
Sets the callback executed when an unknown command is run
Gets the ConsoleSender instance for executing commands from console
Creates the commands packet for a specific player (for auto-completion)
Command
Represents a command with suggestion/auto-completion support.Creating Commands
Command Methods
Adds a new syntax to the commandReturns the created syntaxes (multiple if optional arguments are used)
Adds a syntax with a condition
Sets the executor called when no syntax matches
Sets the command condition (checked before execution)
Sets a callback for argument errors
Adds a subcommand
Gets the main command name
Gets all command aliases
Gets all syntaxes of this command
Argument Types
TheArgumentType class provides factory methods for all built-in argument types.
Basic Arguments
Parses boolean values (true/false)
Parses integer values
Parses double values
Parses float values
Parses long values
Parses string values (quoted or single word)
Parses a single word (no spaces)
Parses remaining arguments as string array
Minecraft-Specific Arguments
Parses entity selectors (@p, @a, @e, etc.)
Parses item stack with optional NBT
Parses block state with properties
Parses chat colors
Parses JSON text components
Parses NBT tags
Parses NBT compound tags
Parses block positions (supports relative coordinates)
Parses 3D vectors (supports relative coordinates)
Parses UUIDs
Parses time values (with units: s, t, d)
Parses resource locations from a registry
Parses particle types with data
Argument Utilities
Matches a literal string (for subcommands)
Groups multiple arguments
Repeats argument pattern
Argument Customization
All argument types extend the baseArgument<T> class with these methods:
Sets a default value (makes argument optional)
Sets custom tab-completion suggestions
Sets error callback for this argument
Maps argument output to another type
Adds a filter predicate
Usage Examples
Commands are registered globally through the CommandManager. Each syntax is tried in order until one matches.
