Skip to content

PluginPermissions

Namespace Mc.Scripting.Permissions · Kind class (sealed)

public sealed class PluginPermissions

Permissions as seen by one plugin (plugin.Permissions): declare the nodes it uses, query players, and optionally replace the backend. Everything declared here is removed when the plugin unloads or hot-reloads.

Member Description
FilePermissionProvider BuiltIn { get; } The built-in file backend (groups and player overrides stored in permissions.json).
public FilePermissionProvider BuiltIn { get; }

The built-in file backend (groups and player overrides stored in permissions.json).

Member Description
bool Has(Player player, string node) Whether the player has the permission.
bool Has(Uuid player, string node) Whether the player (online or not) has the permission.
void Register(Permission permission) Declares a permission node.
void Register(string node, PermissionDefault default, string description = "") Declares a permission node with its default and a description.
void SetProvider(IPermissionProvider provider) Replaces the permission backend for as long as this plugin is loaded (a LuckPerms-style plugin does this in OnEnable).
public bool Has(Player player, string node)

Whether the player has the permission.

Parameters

Name Type Description
player Player The player.
node string The node.

Returns bool

public bool Has(Uuid player, string node)

Whether the player (online or not) has the permission.

Parameters

Name Type Description
player Uuid The profile id.
node string The node.

Returns bool

public void Register(Permission permission)

Declares a permission node.

Parameters

Name Type Description
permission Permission The node, default and description.
public void Register(string node, PermissionDefault default, string description = "")

Declares a permission node with its default and a description.

Parameters

Name Type Description
node string The dotted node, e.g. “homes.use”.
default PermissionDefault What the node is worth when no group or player entry decides.
description string = "" What the permission allows.
public void SetProvider(IPermissionProvider provider)

Replaces the permission backend for as long as this plugin is loaded (a LuckPerms-style plugin does this in OnEnable).

Parameters

Name Type Description
provider IPermissionProvider The backend.

FilePermissionProvider · IPermissionProvider · Permission · PermissionDefault · Player · Uuid