Annotation Interface OnClientCommand


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface OnClientCommand
Registers the method with Events.onMain(Class, Consumer) for the ClientCommandEvents of one module, and optionally one command. The method has one parameter, a ClientCommandEvent; otherwise the rules of Events.register(Object) apply, and the method carries none of the other listener annotations.
@OnClientCommand(module = "Shop", command = "buy", cancel = true)
void buy(ClientCommandEvent event) { ... }
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The Lua module, matched exactly; not blank.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Cancels the event before the method runs, so Lua's OnClientCommand does not receive the command, also when the method throws.
    The command, matched exactly; empty matches every command of the module.
  • Element Details

    • module

      String module
      The Lua module, matched exactly; not blank.
    • command

      String command
      The command, matched exactly; empty matches every command of the module.
      Default:
      ""
    • cancel

      boolean cancel
      Cancels the event before the method runs, so Lua's OnClientCommand does not receive the command, also when the method throws.
      Default:
      false