To create a command you have to extend your VCommand class. This abstract class will allow you to manage your command very easily
public class CommandExample extends VCommand {
public CommandExample(Template plugin) {
protected CommandType perform(Template plugin) {
return null;
The perform function will execute the command, you must return the type of the command, this enumeration will determine if the command has been executed correctly or not.
public class CommandExample extends VCommand {
public CommandExample(Template plugin) {
protected CommandType perform(Template plugin) {
message(this.sender, "Hello world");
return CommandType.SUCCESS;
So here you have a simple command that will send the message Hello world to the user who will execute the command and which has the template.example permission. Permissions are managed with an enumeration.
You can add subcommands very easily with the addSubCommand method.
public class CommandExampleTest extends VCommand {
public CommandExampleTest(Template plugin) {
protected CommandType perform(Template plugin) {
message(player, "Hey %s", player.getName());
return CommandType.SUCCESS;
Order the construtor of your command you must add this:
this.addSubCommand(new CommandExampleTest(plugin));
This gives us the command /example sub.


Now that you have created your order you need to register it. For this you have two different ways to do it. The classic way, where you need to register your order in the plugin.yml. Or you can directly register your order from your plugin.

Register plugin.yml

So you have to add the command in the plugin.yml and then you have to call the method registerCommand(string, command) of the class CommandManager.
this.commandManager.registerCommand("example", new CommandExample(this));

Register bukkit injection

The fastest way to add a command is to directly add your command with the injection in bukkit. For this you have the method registerCommand(string, command, aliases).
You can call this method from your main class, a function with the same arguments exists in the ZUtils class.
this.registerCommand("example", new CommandExample(this), "exemple");


In the builder you can put all the information of your command


You can give a description to your command with the method setDescription.
this.setDescription("Beautiful command");
So you have a description directly in string and a description with the Message enumeration.


You can give a permission to your command with the method setPermission.
So you have a permission directly in string and a description with the Permission enumeration.


You can disable access to the command for the console, by default the value is true.

Required arguments

You can tell your command that arguments are required for the execution of the command.
this.addRequireArg("arg description");
You have to give the name of the argument as a parameter, the name will be used for the generation of the command syntax.

Optional arguments

You can tell your command that arguments are optional for the execution of the command.
this.addOptionalArg("arg descrition")
You have to give the name of the argument as a parameter, the name will be used for the generation of the command syntax.

Sub commands

The subCommand method will add an alias to your current command and will also allow you to add a subcommand.
this.addSubCommand("test"); // aliases
this.addSubCommand(new CommandExampleTest3(plugin)); // sub commands
this.addSubCommand(new CommandExampleTest4(plugin));


By default, the syntax will be generated automatically, but you can give the syntax with the method setSyntax.
this.setSyntax("/example <arg> [<sub>]");


You can also manage the tab completion. The plugin will automatically manage the tab completion with the sub commands. But for your arguments you have to manage it yourself.

Ignore args / parents

You can ignore the argument and parent limit, this allows you to put as many arguments as possible in your command. Perfect for a broadcast command for example.


Maintenant que le constructeur de votre commande est terminé, vous devez gérer l'exécution de votre commande. Si votre commande contient des arguments obligatoires ou optionnels, vous pourrez les récupérer très facilement. Vous pouvez directement donner un type à vos arguments avec la classe Arguments.
For each type you can directly get a default value.
String str = this.argAsString(index);
String str = this.argAsString(index, defaultValue);
int value = this.argAsInteger(index);
int value = this.argAsInteger(index, defaultValue);
long value = this.argAsLong(index);
long value = this.argAsLong(index, defaultValue);
double value = this.argAsDouble(index);
double value = this.argAsDouble(index, defaultValue);
Player player = this.argAsPlayer(index);
Player player = this.argAsPlayer(index, defaultValue);
OfflinePlayer offlinePlayer = this.argAsOfflinePlayer(index);
OfflinePlayer offlinePlayer = this.argAsOfflinePlayer(index, defaultValue);
Location location = this.argAsLocation(index);
Location location = this.argAsLocation(index, defaultValue);
EntityType entityType = this.argAsEntityType(index);
EntityType entityType = this.argAsEntityType(index, defaultValue);
World world = this.argAsWorld(index);
World world = this.argAsWorld(index, defaultValue);
Be careful, the index always starts at 0 no matter where your command is. If you have the command /example test sub <need> [<optional>]. The need argument will be 0 and the optional argument will be 1.


To enable tab completion you need to add setTabCompletor(); to the constructor of your command.
Then you have to override the toTab function.
public List<String> toTab(Template plugin, CommandSender sender, String[] args) {
return null;
You have to check the content of the array and return a string list.