Skip to main content

Command Permissions

Gate’s permission system allows you to control who can execute commands and access features.

Permission Interface

The permission.Subject interface is implemented by command sources:
Source: pkg/util/permission/permission.go

Basic Permission Checks

In Command Requirements

Add permission checks when registering commands:
Source: pkg/command/command.go:70-78

In Command Execution

Check permissions during command execution:

Permission Levels

Organize permissions hierarchically:

Built-in Command Permissions

Gate’s built-in commands use these permissions:
Enable permission checks for built-in commands with:
in config.yml

Permission Checks for Players

Check permissions on player objects:

Console vs Players

Different sources have different permission behavior:

Implementing Permission Providers

Gate doesn’t include a permission management system by default. Implement your own:

Simple File-based Permissions

Integrating with Players

Wrap player objects to add permission checking:

External Permission Plugins

Integrate with permission plugins on backend servers:

LuckPerms Integration

Query LuckPerms via plugin messages:

Dynamic Permissions

Grant temporary permissions:

Best Practices

Use a consistent naming scheme:
  • plugin.category.action format
  • All lowercase with dots as separators
  • Specific to general: gate.admin.kick not kick.admin.gate
Examples:
  • myplugin.command.teleport
  • myplugin.admin.reload
  • myplugin.feature.fly
Support wildcard permissions for convenience:
  • myplugin.* - All plugin permissions
  • myplugin.admin.* - All admin permissions
  • * - All permissions (superadmin)
But be careful with wildcards in production!
Some permissions should be granted by default:
Always grant console full permissions:

Next Steps

Command Examples

See complete command with permissions

Event System

Learn about Gate’s event system