A tool to help register commands using the bukkit api.
CommandManager gives you the ability to register commands without even touching plugin.yml
CommandManager makes use of reflection and adds the SubCommand to the server's command map
First add jitpack to the repo list
repositories {
maven { url 'https://jitpack.io' }
}
Second add CommandManager to the dependencies
dependencies {
implementation 'com.github.Miqhtiedev:CommandManager:v1.0.0'
}
In the onEnable function create an instance of the CommandManager like so
private static CommandManager commandManager;
@Override
public void onEnable(){
commandManager = new CommandManager(this);
}
Create a command! Make a new class that extends SubCommand and then add some code!
public class CoolCommand extends SubCommand {
protected CoolCommand(String name) {
super(name);
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
sender.sendMessage("This is cool!");
return false;
}
}
Finally, register the command.
private static CommandManager commandManager;
@Override
public void onEnable(){
commandManager = new CommandManager(this);
commandManager.registerCommand(new CoolCommand("cool"));
}