Docs » API reference » Permissions

Permissions

Who may do what: operators and permission names.

A permission is a name such as warps.set. Operators have every permission. They are kept in the server's plugins/operators.txt, one player ID a line, which the owner can edit and a plugin can change with add_operator. Anything finer, such as groups or ranks, comes from a permission manager plugin that offers the permissions service, and has then asks that plugin.

You get one from server.permissions().

Methods

MethodDescription
fn has(&self, player: Player, permission: &str) -> Result<bool>boolean has(Player player, String permission)Whether a player has a permission.
fn declare(&self, permission: &str, default: PermissionDefault, description: &str) -> Result<()>void declare(String permission, PermissionDefault default_, String description)Names a permission this plugin checks, so owners and managers can list it.
fn declared(&self) -> Result<Vec<String>>List<String> declared()Every permission every plugin declared.
fn is_operator(&self, id: PlayerId) -> Result<bool>boolean isOperator(String id)Whether a player is an operator.
fn add_operator(&self, id: PlayerId) -> Result<()>void addOperator(String id)Makes a player an operator (kept in plugins/operators.txt).
fn remove_operator(&self, id: PlayerId) -> Result<()>void removeOperator(String id)Takes a player off the operators.

PermissionDefault

Who has a permission when no manager says otherwise.

One of a fixed set of values.

ValueMeaning
PermissionDefault::EveryonePermissionDefault.EVERYONEEveryone.
PermissionDefault::OperatorsPermissionDefault.OPERATORSOperators only.
PermissionDefault::NobodyPermissionDefault.NOBODYNobody.