Essential’s Command API provides a powerful, annotation-based system for creating custom commands with automatic argument parsing. The main selling point of this API is that all command arguments are automatically described by the parameters to your handler functions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SparkUniverse/Essential-Mod/llms.txt
Use this file to discover all available pages before exploring further.
Key Features
- Automatic Argument Parsing: Command arguments are defined by function parameters
- Type Safety: Built-in support for primitives (Int, Boolean, String, etc.)
- Subcommands: Easy creation of nested command structures
- Optional Arguments: Support for nullable types in Kotlin and
Optionalin Java - Custom Parsers: Extensible argument parsing system
- Auto-generated Help: Automatic help subcommand generation
- Tab Completion: Built-in tab completion support
Basic Structure
To create a command, extend theCommand class:
Command Components
Default Handler
A function annotated with@DefaultHandler is invoked when the command is called with no subcommands:
Subcommands
Functions annotated with@SubCommand create subcommands:
Arguments
Arguments are defined by function parameters:Constructor Parameters
When creating a command, you can configure:name: The command name (required)autoHelpSubcommand: Generate automatic help subcommand (default:true)hideFromAutocomplete: Hide from tab completion (default:false)
Command Aliases
You can define global aliases for your command:Next Steps
Creating Commands
Learn how to create your first command
Arguments
Understand the argument parsing system
Subcommands
Create complex command hierarchies
Registry
Register commands and custom parsers