Skip to content
MyoWiki SSEC · 26.1

Command System

SSEC command registration is built around five annotations:

  • @SSCommand declares a root command or subcommand class
  • @SSCExecute marks the executable method
  • @SSCArgument maps method parameters to Brigadier arguments
  • @SSCAlias registers redirect aliases
  • @SSCPermission applies permission rules
@SSCommand("greeting")
@SSCAlias({ "hi", "hello" })
@SSCPermission(permission = PermissionLevel.GAME_MASTER)
public class GreetingCommand {
@SSCExecute
public static void execute(
CommandContext<CommandSourceStack> ctx,
@SSCArgument("name") String name
) {
// ...
}
@SSCommand(value = "shout", parent = GreetingCommand.class)
public static class ShoutCommand {
@SSCExecute
public static void execute(
CommandContext<CommandSourceStack> ctx,
@SSCArgument("msg") String msg
) {
// ...
}
}
}

This produces a root command plus a nested subcommand without hand-writing literal and argument builders.

The registrar:

  • verifies @SSCommand is present
  • builds a Brigadier tree from the annotated class graph
  • resolves parent-child relationships, including cross-file parents
  • registers root aliases and subcommand aliases
  • applies permission predicates
  • maps Java parameter types to Brigadier argument types through the adapter registry

CommandRegistrar pre-registers adapters for primitives, strings, vectors, entities, block positions, NBT, scoreboard types, colors, styles, UUIDs, and more.

For the full supported set, see Argument Types.

If a parameter type is not built in, register an SSCArgumentAdapter during onInitializeSSEC().

public class MyCommandInitializer implements SSECInitializer {
@Override
public void onInitializeSSEC() {
CommandRegistrar.registerAdapter(MyType.class, new MyTypeAdapter());
}
@Override
public String[] getPackagesToScan() {
return new String[] { "com.example.mymod.command" };
}
}
  • Keep @SSCExecute methods static unless you have a reason to instantiate a target.
  • Put reusable permission policy on the command class, then use propagate when children should inherit it.
  • Register custom adapters before the scan runs.
  • Treat aliases as redirects, not independent command implementations.