Command Framework
- Native Minecraft Version:
- 1.17
- Tested Minecraft Versions:
- 1.8
- 1.9
- 1.10
- 1.11
- 1.12
- 1.13
- 1.14
- 1.15
- 1.16
- 1.17
- Source Code:
- https://github.com/Despical/CommandFramework
- Contributors:
- Despical
- Donation Link:
- https://www.patreon.com/despical
This framework is very lightweight annotation based command system that works similar to Bukkit's event system. It removes the necessity to add command to your plugin.yml but will still allow you to set command usage, description, permission, aliases, sender type, cooldown, minimum and maximum argument length through the code and adds bunch of new methods to improve your code.
Documentation
More information can be found on the wiki page. The Javadoc can be browsed. Questions related to the usage of Command Framework should be posted on my Discord server.
Using Command Framework
The project isn't in the Central Repository yet, so specifying a repository is needed.
To add this project as a dependency to your project, add the following to your pom.xml:
Maven dependency
Code (XML):<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>Code (XML):<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>CommandFramework</artifactId>
<version>1.0.6-pre1</version>
<scope>compile</scope>
</dependency>
Gradle dependency
Code (XML):repositories {
maven { url 'https://jitpack.io' }
}Code (XML):dependencies {
compileOnly group: "com.github.Despical", name: "CommandFramework", version: "1.0.6-pre1";
}
Example usage
Code (Java):public class ExampleClass extends JavaPlugin {
// Don't forget to shade framework into your project
private CommandFramework commandFramework;
@Override
public void onEnable() {
// Initialize the framework before using
commandFramework = new CommandFramework(this);
// Then this will register all the @Command methods as a command
// so there is no necessity to add command to your plugin.yml
commandFramework.registerCommands(this);
commandFramework.setAnyMatch(arguments -> {
if (arguments.isArgumentsEmpty()) return;
String label = arguments.getLabel(), arg = arguments.getArgument(0);
// StringMatcher is an external class from Despical's Commons library which is not in this framework
ListStringMatcher.Match> matches = StringMatcher.match(arg, commandFramework.getCommands().stream().map(cmd -> cmd.name().replace(label + ".", "")).collect(Collectors.toList()));
if (!matches.isEmpty()) {
arguments.sendMessage("Did you mean %command%?").replace("%command%", label + " " + matches.get(0).getMatch());
}
}
// Before creating command the method must only have
// CommandArguments parameter and also @Command annotation
@Command(name = "example",
aliases = {"firstAlias", "secondAlias"},
permission = "example.permission",
desc = "Sends an example message to sender",
usage = "/example",
min = 1,
max = 5,
cooldown = 10,
senderType = Command.SenderType.CONSOLE)
public void exampleCommandMethod(CommandArguments arguments) {
// And here it's all done, you've created command with properties above!
arguments.sendMessage("This is how you can create a example command using framework.");
}
// Aliases don't need to be same with the command above
@Completer(name = "example", aliases = {"firstAlias", "secondAlias"})
public List<String> exampleCommandCompletion(CommandArguments arguments) {
// And you've created a tab completion for the command above
return Arrays.asList("first", "second", "third");
}
}
Example plugins
You can always DM me if you are using this framework and want to be on list.
- King of the Ladder by Despical
- One in the Chamber by Despical
Donations
You like the Command Framework? Then donate back me to support the development.
Additional links

Command Framework 1.0.5
A lightweight annotation based command system