CommandAPI - Modern Tool for Working with Commands in Minecraft
CommandAPI is a powerful API for Bukkit/Spigot servers that fully implements the functionality of the command user interface introduced in Minecraft 1.13 update.
Main Features
This library dramatically simplifies the process of creating and managing commands, offering developers the following advantages:
- Smart argument validation - automatic checking and conversion of incoming data into required types
- Extended command executor support - ability to execute commands on behalf of various entities via /execute
- Minecraft functions integration - compatibility with the game's function and tag system
- Simplified registration - no longer need to specify commands in plugin.yml file
- Standalone operation - doesn't require additional dependencies like Brigadier
- Privacy - complete absence of statistics collection and tracking

Automatic Type Conversion
Forget about manual argument type checking! CommandAPI automatically converts incoming data into required types:
// Instead of the old approach:
onCommand(CommandSender sender, Command command, String label, String[] args) {
try {
int i = Integer.parseInt(args[0]);
// Working with number
catch (NumberFormatException e) {
// Error handling
}
}
// New approach with CommandAPI:
new CommandAPICommand("mycommand")
.withArguments(new IntegerArgument("myint"))
.executes((sender, args) -> {
int i = (int) args.get("myint");
// Working with number
})
.register();
The library supports over 40 different argument types, including enchantments, entity types, locations, items, potion effects, and much more!
Command Sender Type Checking
No longer need to manually check if the command sender is a player:
new CommandAPICommand("mycommand")
.withArguments(arguments)
.executesPlayer((player, args) -> {
player.sendMessage("Hello " + player.getDisplayName());
})
.register();
Additional Features
CommandAPI also offers:
- Restricting numerical values to specific ranges
- Coordinate handling with support for relative values (~)
- JSON parsing into BaseComponent[] objects
- Player suggestions based on online list
- Creating custom arguments
- Applying permissions to individual arguments
- Converting commands from other plugins to work with /execute
- Handling command execution results
- Context-aware suggestions based on entered data
Built-in Plugin Converter
A special conversion system allows making commands from any plugins compatible with Minecraft's /execute system and datapacks, even if they weren't originally developed using CommandAPI.