CommandActionEvent - S3nS3IW00/JCommands GitHub Wiki

This event gets triggered on a valid command usage.

It contains the following information in addition to the base event:

  • the channel where the command has been used and
  • a list of ArgumentResult that contains the result of the arguments that the user specified

Register event

This event belongs to command and argument aswell, and it can be registered with Command#setOnAction(CommandActionEventListener) or SubArgument#setOnAction(CommandEventListener) with a CommandActionEventListener as parameter.

This can be done by the following way:

commandOrSubArgument.setOnAction(event -> {
    //...
});

Good to know

  • When a listener registered in an argument only results after the argument included in the event
  • All of the registered listeners in the same scope get triggered, command's listener is the last
  • The first triggered listener that has a response will respond to the command, all other responders will be ignored