forked from EndstoneMC/cpp-example-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.cpp
More file actions
36 lines (31 loc) · 1.5 KB
/
Copy pathplugin.cpp
File metadata and controls
36 lines (31 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "plugin.h"
#include "version.h"
// The ENDSTONE_PLUGIN macro defines the metadata for the plugin.
// This is where you set the plugin name, version, and main class,
// and declare commands and permissions.
ENDSTONE_PLUGIN(/*name=*/"cpp_example", /*version=*/CPP_EXAMPLE_VERSION, /*main_class=*/ExamplePlugin)
{
prefix = "ExamplePlugin";
description = "C++ example plugin for Endstone servers";
website = "https://github.com/EndstoneMC/cpp-example-plugin";
authors = {"Endstone Developers <hello@endstone.dev>"};
// Commands are declared with a fluent builder API.
// The "permissions" field controls who can use the command.
command("hello")
.description("Send a greeting")
.usages("/hello")
.permissions("example.command.hello");
command("broadcast")
.description("Broadcast a message to all players")
.usages("/broadcast <message: message>")
.permissions("example.command.broadcast");
// Permissions are declared separately from commands. The default_ field controls
// who gets the permission automatically: True = everyone, Operator = ops only,
// False = no one (must be explicitly granted).
permission("example.command.hello")
.description("Allow users to use the /hello command.")
.default_(endstone::PermissionDefault::True);
permission("example.command.broadcast")
.description("Allow users to use the /broadcast command.")
.default_(endstone::PermissionDefault::Operator);
}