StrokkCommands is a very simple and lightweight compile-time library for generating Brigadier command trees from annotation! Have you ever though: "Oh boy, my command is far too hard to read to maintain"? Well, this is the solution!!!
You can read the documentation at https://commands.strokkur.net!
Talking doesn't cut it, so why don't I show you? Here is a Brigadier command:
public static LiteralCommandNode<CommandSourceStack> create() {
return Commands.literal("adventure")
.then(Commands.literal("send")
.then(Commands.literal("message")
.then(Commands.argument("message", StringArgumentType.string())
.then(Commands.literal("with")
.then(Commands.literal("color")
.then(Commands.argument("color", ArgumentTypes.namedColor())
.executes(ctx -> {
// Your command logic
return Command.SINGLE_SUCCESS;
})
)
)
)
)
)
).build();
}
Ugly, isn't it? This denotes the command /adventure send message <message> with color <color>
. Why does this
take up so much space? I don't know! And that is why I created StrokkCommands! Let's take a look:
@Command("adventure")
class AdventureArgumentsCommand {
@Executes("send message")
void executes(CommandSender sender,
@StringArg(STRING) String message,
@Literal("with") String $with,
@Literal("color") String $color,
NamedTextColor color) {
// Your command logic
}
}
Tiny, isn't it?