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.
1. Install Reedwork
Section titled “1. Install Reedwork”First, install Reedwork to your Paper plugin project.
2. Scan Your Plugin Package
Section titled “2. Scan Your Plugin Package”Reedwork uses package scanning to discover annotated components such as commands.
Start by creating your main plugin class:
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().
3. Create the Command
Section titled “3. Create the Command”Now create a commands package
Create HelloReedworkCommand:
Directorysrc/main/java/
Directorydev.reedworkmc.examples.fiveminutecommand
Directorycommands
- HelloReedworkCommand.java
- FiveMinuteCommand.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
Section titled “@Command”@Command("hello")This defines the command name.
In this case, Reedwork creates:
/hello@CommandHandler
Section titled “@CommandHandler”@CommandHandlerpublic 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!"));4. Build and Test
Section titled “4. Build and Test”Build your plugin:
mvn clean packageCopy the resulting JAR from target/ into the plugins/ directory of your Paper server.
Start the server.
Reedwork will scan:
dev.reedworkmc.examples.fiveminutecommandand automatically discover HelloReedworkCommand.
You can now execute:
/helloThe server responds with:
Hello Reedwork!That’s it — you have created a PaperMC command with Reedwork without manually registering it.
What You Learned
Section titled “What You Learned”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
Next Steps
Section titled “Next Steps”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:
- Events — react to Paper/Bukkit events
- Dependency Injection — inject dependencies into your components
- Custom Enchantments — create your first Reedwork enchantment