Permissions
Gate commands behind permissions and set who holds them by default.
Permissions decide who may do what. Every command requires the operator permission by default; attach your own permission to open a command up or lock it down, and set the permission's default to say who holds it.
Attach a permission to a command
To let everyone use /hello, attach a permission and set its default:
from endstone.plugin import Plugin
class MyPlugin(Plugin):
api_version = "0.11"
commands = {
"hello": {
"description": "Greet the command sender.",
"usages": ["/hello"],
"permissions": ["my_plugin.command.hello"],
}
}
permissions = {
"my_plugin.command.hello": {
"description": "Allow users to use the /hello command.",
"default": True,
}
}Permission defaults
The default field sets who holds the permission:
| Value | Who holds it |
|---|---|
True | Everyone |
False | No one, unless explicitly granted |
"op" | Operators only |
"not_op" | Non-operators only |
"console" | Console only |