Skip to content

Commit

Permalink
feat: add permissions in example plugin command registration
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Mar 14, 2024
1 parent 4a3d24b commit dbebdbc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/example_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ class ExamplePlugin : public endstone::Plugin {
void onEnable() override
{
getLogger().info("onEnable is called");

auto *root = registerPermission("cpp_example.command",
"Allow users to use all commands provided by this example plugin");
registerPermission(root, "cpp_example.command.fibonacci", "Allow users to use the fibonacci command",
endstone::PermissionDefault::Operator);

registerCommand("fibonacci", // name
"A simple command that writes the Fibonacci series up to n.", // description
{"/fibonacci <n: int>"}, // usages
{"fib"} // aliases
)
{"fib"}, // aliases
{"cpp_example.command.fibonacci"}) // permissions
->setExecutor(std::make_unique<FibonacciCommandExecutor>());
}

Expand Down

0 comments on commit dbebdbc

Please sign in to comment.