Code Patterns

Copy-paste examples for common plugin tasks. Commands, events, ECS, GUI, and more.

← Back to Patterns
command

Register Command

Register a command in the plugin setup() method.

Example Code

java
@Override
protected void setup() {
    this.getCommandRegistry().registerCommand(new MyCommand());
    this.getCommandRegistry().registerCommand(new AnotherCommand("name", "description"));
}

Common Mistakes

Registering commands outside of setup() may not work correctly.