An annotation-driven command & event framework for Minecraft Fabric.
Register commands and events with annotations only β no Brigadier boilerplate required.
π°π· νκ΅μ΄ λ¬Έμ (Korean)
| Feature | Description |
|---|---|
| Annotation-based Commands | Auto-register commands with @SSCommand + @SSCExecute |
| Subcommand Support | Nested subcommands via parent (inner class / external class) |
| Alias System | @SSCAlias with absolute (/) and relative path support |
| Permission System | @SSCPermission β OP Level, LuckPerms, Custom Checker |
| Auto Argument Mapping | @SSCArgument for automatic parameter mapping (int, String, Vec3, Entity, etc.) |
| Event Registration | @SSEvent for automatic Fabric event listener registration |
| Debug Mode | @SSECDebug for dev-environment-only commands/events |
| Classpath Scanning | SSECScanner auto-discovers and registers annotated classes |
Register your initializer classes in fabric.mod.json:
{
"entrypoints": {
"ssec": [
"com.example.mymod.event.MyEventInitializer",
"com.example.mymod.command.MyCommandInitializer"
]
}
}Implement SSECInitializer to define packages to scan and perform additional setup:
public class MyCommandInitializer implements SSECInitializer {
@Override
public void onInitializeSSEC() {
// Register custom argument adapters, additional setup, etc.
// CommandRegistrar.registerAdapter(MyType.class, new MyTypeAdapter());
}
@Override
public String[] getPackagesToScan() {
// Specify packages containing @SSCommand / @SSEvent annotated classes
return new String[] { "com.example.mymod.command" };
}
}getPackagesToScan()β Returns packages thatSSECScannerwill scan for annotated classesonInitializeSSEC()β Called during initialization; use it to register customSSCArgumentAdapters or perform any additional setup
@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) {
ctx.getSource().sendSuccess(
() -> Component.literal("Hello, " + name + "!"), false);
}
@SSCommand(value = "shout", parent = GreetingCommand.class)
public static class ShoutCommand {
@SSCExecute
public static void execute(CommandContext<CommandSourceStack> ctx,
@SSCArgument("msg") String msg) {
ctx.getSource().sendSuccess(
() -> Component.literal("Β§l" + msg.toUpperCase()), false);
}
}
}This registers the following commands automatically:
/greeting <name>(aliases:/hi,/hello)/greeting shout <msg>
public class MyEvents {
@SSEvent(ServerLifecycleEvents.ServerStarting.class)
public static void onServerStart(MinecraftServer server) {
// Server starting logic
}
}| Annotation | Target | Description |
|---|---|---|
@SSCommand |
Class | Define a command/subcommand. value = name, parent = parent class |
@SSCExecute |
Method | Mark the execution method (must be static) |
@SSCArgument |
Parameter | Map a parameter to a Brigadier argument |
@SSCAlias |
Class | Register command aliases (via redirect) |
@SSCPermission |
Class/Method | Configure permissions |
| Annotation | Target | Description |
|---|---|---|
@SSEvent |
Method | Register a Fabric event listener. Control order with priority |
@SSECDebug |
Class/Method | Active only in dev environment (isDevelopmentEnvironment) |
@SSCPermission supports one of three modes:
// 1. Vanilla OP Level
@SSCPermission(permission = PermissionLevel.GAME_MASTER)
// 2. LuckPerms / Fabric Permissions API
@SSCPermission(value = "mymod.admin")
// 3. Custom Checker
@SSCPermission(custom = MyPermissionChecker.class)| Level | Description |
|---|---|
NONE |
Unspecified (default) |
MODERATOR |
Moderator |
GAME_MASTER |
Game Master |
ADMIN |
Admin |
OWNER |
Owner |
propagate = false(default): Permission applies to the current command onlypropagate = true: Permission cascades to all subcommands
@SSCAlias uses a /-based path system.
| Rule | Example | Result |
|---|---|---|
Absolute (starts with /) |
@SSCAlias("/s") |
/s |
| Absolute multi-segment | @SSCAlias("/other/sub") |
/other sub (requires other command) |
Relative (no leading /) |
@SSCAlias("alt") on child of "test" |
/test alt |
| Relative multi-segment | @SSCAlias("a/b") on child of "test" |
/test a b |
β οΈ AnIllegalStateExceptionis thrown if the root command referenced by an absolute path does not exist.
| Java Type | Brigadier Mapping |
|---|---|
int / Integer |
IntegerArgumentType |
double / Double |
DoubleArgumentType |
float / Float |
FloatArgumentType |
boolean / Boolean |
BoolArgumentType |
String |
StringArgumentType |
UUID |
UuidArgument |
ChatFormatting |
ColorArgument |
Component |
ComponentArgument |
Style |
StyleArgument |
CompoundTag |
CompoundTagArgument |
NbtPathArgument.NbtPath |
NbtPathArgument |
BlockInput |
BlockStateArgument |
BlockPos |
BlockPosArgument |
ColumnPos |
ColumnPosArgument |
Vec2 |
Vec2Argument |
Vec3 |
Vec3Argument |
AngleArgument.SingleAngle |
AngleArgument |
EntityAnchorArgument.Anchor |
EntityAnchorArgument |
Entity |
EntityArgument.entity() |
Entity[] |
EntityArgument.entities() |
ServerPlayer |
EntityArgument.player() |
ServerPlayer[] |
EntityArgument.players() |
ServerLevel |
DimensionArgument |
GameType |
GameModeArgument |
Heightmap.Types |
HeightmapTypeArgument |
DisplaySlot |
ScoreboardSlotArgument |
ScoreHolder |
ScoreHolderArgument |
PlayerTeam |
TeamArgument |
SlotRange |
SlotsArgument |
Mirror |
TemplateMirrorArgument |
Rotation |
TemplateRotationArgument |
Register custom types via SSCArgumentAdapter and CommandRegistrar.registerAdapter().
me.myogoo.ssec
βββ api/ # Public API
β βββ SSECDebug # Debug-only annotation
β βββ SSECInitializer # Initializer interface
β βββ command/ # Command annotations
β β βββ SSCommand # Command definition
β β βββ SSCExecute # Execution method marker
β β βββ SSCArgument # Argument binding
β β βββ SSCAlias # Alias definition
β β βββ SSCPermission # Permission control
β β βββ argument/ # Argument adapter API
β β βββ permission/ # Permission enums & interfaces
β βββ event/
β βββ SSEvent # Event listener annotation
βββ command/ # Internal implementation
β βββ CommandRegistrar # Command registration engine
β βββ argument/ # Built-in argument adapters
βββ event/
β βββ EventRegistrar # Event registration engine
βββ util/
βββ SSECScanner # Classpath scanner
This project is licensed under the LGPL-3.0.