-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Remminiscent edited this page Jun 27, 2026
·
3 revisions
composer require remminiscent/pmcommandtreeCall this once in your plugin:
use remmi\PMCommandTree\PMCommandTree;
protected function onEnable(): void
{
PMCommandTree::register($this);
}Create a CommandRouteTree, set a root permission, add nodes, then register a RouteCommand.
$tree = new CommandRouteTree("example");
$root = $tree->getRoot();
$root->permission("example.command");
$root->then(
CommandRouteNode::literal("say")->then(
CommandRouteNode::argument("message", TextArgumentType::text())->exec(
static function (CommandContext $context): CommandResult {
$context->getSender()->sendMessage($context->getArg("message"));
return $context->success();
}
)
)
);The builder API is fluent, so chaining and variables both work. Write routes whichever way you like.
- Root command permissions must exist in
plugin.yml. - Node permissions must also exist before calling
permission().
Made with hate by Remminiscent ❤️