Skip to main content

paper-dispatch

A Maven library for PaperMC plugins that wraps Brigadier in a declarative command API: nested sub-commands, typed arguments, GNU-style flags and permission requirements, without hand-building command trees.

paper-dispatch 1.0.2 β€” supported platforms
Server softwareSupportedMinecraft
Paperβœ”Built against paper-api 26.1.2
Spigotβ€”β€”
Bukkitβ€”β€”
Foliaβ€”β€”
These docs describe 1.0.3, which is not released yet

The current release is 1.0.2, and the API differs. trackCommand, flushRegistrations, getSenderAsPlayer and resolvePlayer β€” used throughout these pages β€” do not exist in 1.0.2; there it is registerCommand, registerCommands and getPlayer().

The dependency snippets still show 1.0.2, because that is what resolves today. See Migrating for the mapping.

What you write​

public class HealCommand extends BaseCommand<MyPlugin> {

public HealCommand(MyPlugin plugin) {
super(plugin, "heal", "h");
this.setPermission("myplugin.heal");
this.addOptionalArgument("target", ArgumentTypes.player());
this.addFlag(Flags.boolFlag("silent").alias("s"));
}

@Override
protected CommandResultType perform(CommandDispatch<MyPlugin> dispatch) {
Player target = dispatch.resolvePlayer("target")
.orElse(dispatch.getSenderAsPlayer());
target.setHealth(20.0);
return CommandResultType.SUCCESS;
}
}

/heal Notch -s β€” no Brigadier node assembly anywhere.

Modules​

ModuleContents
Lib-APIPublic API interfaces and abstractions
paper-dispatchFull implementation, includes Lib-API

Depend on paper-dispatch unless you specifically want to compile against the interfaces alone.

Paper only​

This is not a Bukkit library. It compiles against paper-api and uses Paper's Commands / Brigadier API, PluginBootstrap and paper-plugin.yml β€” none of which exist on Spigot or Bukkit. There is no Spigot fallback.

Where to go​

You want to…Go to
Add it to your buildAdd the dependency
Bundle it without breaking othersShading & relocation
Register your first commandCore concepts
Tell arguments from flags apartArguments
Look up the flag APIFlags
Find a class or packageModules
Read generated JavadocJavadoc

Known limitation: no bootstrap registration​

Paper lets you register commands from a PluginBootstrap, which is its preferred path for paper-plugin.yml plugins and the only way commands become available to datapack command functions. paper-dispatch does not support that today.

The blocker is ordering: PluginBootstrap#bootstrap runs before createPlugin, so no plugin instance exists yet β€” while BaseCommand<T extends Plugin> requires one at construction.

If you need datapack function parsing, register those commands directly against context.getLifecycleManager() in your bootstrap and use this library for everything else.