Skip to content

Create a PaperMC Brigadier Command with Reedwork in 5 Minutes

By the end of this tutorial, you will have a working /hello command that automatically gets discovered and registered by Reedwork.

First, install Reedwork to your Paper plugin project.


Reedwork uses package scanning to discover annotated components such as commands.

Start by creating your main plugin class:

FiveMinuteCommand.java
package dev.reedworkmc.examples.fiveminutecommand;
import dev.reedworkmc.reedwork.Reedwork;
import org.bukkit.plugin.java.JavaPlugin;
public final class FiveMinuteCommand extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
Reedwork.create(this).scan("dev.reedworkmc.examples.fiveminutecommand");
}
}

This creates a Reedwork instance for your plugin and scans the specified package for Reedwork components.

Because the command will be located below this package, Reedwork will automatically discover it.

For example:

  • Directorysrc/main/java/
    • Directorydev.reedworkmc.examples.fiveminutecommand
      • FiveMinuteCommand.java

You don’t need to manually register the command in onEnable().


Now create a commands package

Create HelloReedworkCommand:

  • Directorysrc/main/java/
    • Directorydev.reedworkmc.examples.fiveminutecommand
      • Directorycommands
        • HelloReedworkCommand.java
      • FiveMinuteCommand.java
HelloReedworkCommand.java
package dev.reedworkmc.examples.fiveminutecommand.commands;
import dev.reedworkmc.reedwork.annotation.Command;
import dev.reedworkmc.reedwork.annotation.CommandHandler;
import dev.reedworkmc.reedwork.command.CommandContext;
import net.kyori.adventure.text.Component;
@Command("hello")
public class HelloReedworkCommand {
@CommandHandler
public boolean execute(CommandContext context) {
context.sender().sendMessage(Component.text("Hello Reedwork!"));
return true;
}
}

There are two important annotations here.

@Command("hello")

This defines the command name.

In this case, Reedwork creates:

/hello
@CommandHandler
public boolean execute(CommandContext context)

This method handles the command execution.

The CommandContext provides access to information about the current command execution, including the command sender.

Our example simply sends a message:

context.sender().sendMessage(Component.text("Hello Reedwork!"));

Build your plugin:

Terminal window
mvn clean package

Copy the resulting JAR from target/ into the plugins/ directory of your Paper server.

Start the server.

Reedwork will scan:

dev.reedworkmc.examples.fiveminutecommand

and automatically discover HelloReedworkCommand.

You can now execute:

/hello

The server responds with:

Hello Reedwork!

That’s it — you have created a PaperMC command with Reedwork without manually registering it.

In just a few minutes, you learned how to:

  • Install Reedwork in a PaperMC plugin
  • Initialize Reedwork with Reedwork.create(this)
  • Scan your plugin package
  • Create a command with @Command
  • Handle execution with @CommandHandler
  • Access the command sender through CommandContext
  • Let Reedwork automatically discover and register the command

Now that you have created your first command, explore what else Reedwork can do.

Check out the command documentation for more advanced features, or continue with: