Commands
package org.example;
import com.xg7plugins.XG7Plugins;
import com.xg7plugins.commands.node.CommandConfig;
import com.xg7plugins.commands.setup.Command;
import com.xg7plugins.commands.setup.CommandSetup;
import com.xg7plugins.commands.utils.CommandArgs;
import com.xg7plugins.commands.utils.CommandState;
import org.bukkit.command.CommandSender;
@CommandSetup(
name = "example",
description = "An example command",
syntax = "/example",
permission = "myextension.command.example",
pluginClass = XG7Plugins.class,
iconMaterial = XMaterial.DIAMOND
)
public class ExampleCommand implements Command {
@CommandConfig
public CommandState executeRoot(CommandSender sender, CommandArgs args) {
sender.sendMessage("This is an example command!");
sender.sendMessage("ARGS: " + args.toString());
return CommandState.FINE;
}
//IF you want to add subcommands, you can do it like this:
@CommandConfig(
name = "sub",
description = "An example subcommand",
syntax = "/example sub",
permission = "myextension.command.example.sub",
iconMaterial = XMaterial.EMERALD
)
public CommandState sub(CommandSender sender) {
sender.sendMessage("This is an example subcommand!");
return CommandState.FINE;
}
}Atualizado