Skip to main content

@Sub

Marks a method as a subcommand handler. The path is defined by the annotation's value.

Usage


@Sub(value = "info", description = "Show info")
public void info(CommandContext ctx){
ctx.sender().sendMessage("Info!");
}

Nested Paths

Use spaces to define multi-level subcommand paths:


@Sub(value = "settings reset", description = "Reset settings")
public void resetSettings(CommandContext ctx){
// handles /mycommand settings reset
}

Attributes

AttributeRequiredDescription
valueThe subcommand path. Spaces define nesting levels.
descriptionA short description shown in help output.

Notes

  • Required @Arg parameters must always come before optional ones. Placing a required argument after an optional one throws an IllegalArgumentException at registration.
  • Optional @Arg parameters must also be annotated @Nullable.