Interface TextCommandHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TextCommandHandler
Functional interface for handling text (prefix-based) commands.

Preferred approach: Use the @TextCommand annotation directly on methods in your @Plugin class:

@Plugin(name = "MyPlugin", version = "1.0.0", author = "Author")
public class MyPlugin {

    @TextCommand(name = "greet", description = "Greet a user",
            usage = "greet <user>", aliases = {"hi", "hello"})
    public void greet(CommandContext context) {
        context.reply("Hello, " + context.getArgsString() + "!");
    }
}

Alternative: Implement this interface and register via PluginContext.registerCommand(String, TextCommandHandler) for dynamic command registration:

@OnEnable
public void onEnable(PluginContext context) {
    context.registerCommand("greet", ctx -&gt;
        ctx.reply("Hello, " + ctx.getArgsString() + "!"));
}

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Handles a text command invocation.
  • Method Details

    • handle

      void handle(CommandContext context)
      Handles a text command invocation.
      Parameters:
      context - the command context containing the event, arguments, and convenience methods