As you would in a normal bukkit plugin, you need to configure your commands in the plugin.yml file
main:be.garagepoort.tubingexample.TubingExamplename:TubingExampleversion:${project.version}description:Tubing simple example projectauthor:Garagepoortapi-version:1.16commands:broadcast:description:Broadcasts a message to all playersusage:/<command>aliases: [br]
CommandExecutor
The command executor needs to be annotated with @IocBukkitCommandHandler. The handler annotation takes as parameter the id of the command as specified in the plugin.yml file.
@IocBukkitCommandHandler("broadcast")publicclassBroadcastCmdimplementsCommandExecutor {privatefinalMessageService messageService;privatefinalBroadcastingService broadcastingService;publicBroadcastCmd(MessageService messageService,BroadcastingService broadcastingService) {this.messageService= messageService;this.broadcastingService= broadcastingService; } @OverridepublicbooleanonCommand(CommandSender sender,Command command,String alias,String[] args) {try {if(args.length<1) {thrownewBusinessException("Invalid arguments given for broadcast. Must provide a message"); }String message =JavaUtils.compileWords(args,0);broadcastingService.broadcast(sender, message);returntrue; } catch (BusinessException e) {messageService.sendMessage(sender,"&6[Broadcasts] &C"+e.getMessage());returnfalse; } }}