From dbebdbc5317717c9c4bfccdf08b85867cc0dba5c Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 14 Mar 2024 17:10:39 +0000 Subject: [PATCH] feat: add permissions in example plugin command registration --- include/example_plugin.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/example_plugin.h b/include/example_plugin.h index 2d91386..19f0b9a 100644 --- a/include/example_plugin.h +++ b/include/example_plugin.h @@ -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 "}, // usages - {"fib"} // aliases - ) + {"fib"}, // aliases + {"cpp_example.command.fibonacci"}) // permissions ->setExecutor(std::make_unique()); }