Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProjectUnified/CraftCommand/llms.txt

Use this file to discover all available pages before exploring further.

CraftCommand is an opinionated, annotation-driven command framework for Java. Instead of scanning annotations at runtime with reflection, CraftCommand’s annotation processor reads your @Command and @Subcommand declarations at compile time and generates platform-native wrapper classes using JavaPoet. The result is near-native dispatch speed with no per-invocation reflection overhead.

Quickstart

Build and register your first annotated command in minutes

Installation

Add CraftCommand modules to your Maven project with the BOM

Core Concepts

Understand how compile-time processing and code generation work

Annotation Reference

Complete reference for every annotation CraftCommand provides

Why CraftCommand?

Most Java command frameworks rely on runtime reflection to discover and invoke annotated methods. CraftCommand takes a different approach: the annotation processor runs during javac and emits ordinary Java wrapper classes. By the time your application starts, the command routing is just a chain of plain method calls.

Zero Reflection per Call

One Class.forName at registration time; zero reflection during every subsequent execution

Multi-Platform

Standalone Java, Bukkit/Spigot, and Paper (Brigadier) — one annotation model across all platforms

Extensible via SPI

Register custom argument resolvers, validation handlers, and method handlers through standard Java SPI

Platform Support

Use CraftCommand in any Java application — CLI tools, Discord bots, chatbots, or test harnesses. No Minecraft dependency required.
pom.xml
<dependency>
    <groupId>io.github.projectunified</groupId>
    <artifactId>craftcommand-standalone-runtime</artifactId>
</dependency>

Get Started in 4 Steps

1

Add the BOM and dependencies

Import craftcommand-bom in your <dependencyManagement> block, then declare the annotations and runtime artifacts for your target platform.
2

Configure the annotation processor

Add the platform-specific processor artifact (e.g. craftcommand-standalone-processor) to maven-compiler-plugin’s <annotationProcessorPaths>. The processor runs automatically during mvn compile.
3

Write your command class

Annotate a class with @Command, define subcommands with @Subcommand, mark the default handler with @Default, and declare optional parameters with @Optional.
4

Register and execute

Instantiate the platform’s CommandManager, call manager.register(new YourCommand()), and dispatch user input with command.execute(sender, args).
CraftCommand targets Java 8 and above. All generated wrapper classes are plain Java — no bytecode manipulation, no proxies.

Build docs developers (and LLMs) love