The Complete Example
Here’s a comprehensive command showcasing all of Blade’s major features:Feature Breakdown
Let’s explore each advanced feature in detail.Greedy Arguments
Use@Greedy to capture all remaining text as a single string:
/broadcast This entire message is captured- Works perfectly- Without
@Greedy, you’d need:/broadcast "This entire message is captured"
Quoted Arguments
The@Quoted annotation allows arguments to contain spaces when wrapped in quotes:
@Greedy:
@Greedy- Captures ALL remaining arguments@Quoted- Allows ONE argument to contain spaces if quoted
Range Validation
Use@Range to automatically validate numeric arguments:
@Range(min = 1)- Minimum value only@Range(max = 100)- Maximum value only@Range(min = 1, max = 64)- Both minimum and maximum
Command Flags
Flags provide optional switches that can be placed anywhere in the command:Boolean Flags
Simple on/off switches:Usage:
/tp PlayerName- Normal teleport/tp PlayerName -s- Silent teleport/tp PlayerName -s -f- Silent and forced/tp PlayerName --force- Using long name
Value Flags
Flags can accept values of any type:Usage:
/pay 100 -t PlayerName- Send $100 to PlayerName/pay 50 -t Bob -m "Thanks!"- Send $50 with a message
Async Execution
Run commands asynchronously to avoid blocking the main thread:@Async, be careful not to access Bukkit API methods that must run on the main thread!
Hidden Commands
Hide commands from the help menu:Per-Parameter Custom Providers
Override the provider for specific parameters:Provider.Scope.BOTH- Override both parsing and tab completion (default)Provider.Scope.PARSER- Override only how the argument is parsedProvider.Scope.SUGGESTIONS- Override only tab completion suggestions
Real-World Example
Here’s a practical economy command using multiple features:/economy pay Bob 100- Send $100 to Bob/economy pay Bob 50 -s- Send $50 anonymously/economy pay Bob 25 -m "For the diamonds"- Send $25 with a message/economy pay Bob 75 --silent -m "Secret gift"- Anonymous with message
Next Steps
- Basic Commands - Review the fundamentals
- Subcommands - Organize complex command structures
- Custom Types - Build your own argument providers