Skip to main content

Command Registration

This guide shows you how to register custom commands with Gate’s command manager.

Getting the Command Manager

Access the command manager from the proxy instance:

Basic Registration

Simple Command

Register a command with no arguments:

Command with Arguments

Add arguments to your command:

Command with Aliases

Register a command with multiple names:
Source: pkg/command/command.go:125-138

Permission Requirements

Add permission checks to commands:

Tab Completion

Provide suggestions for command arguments:

Dynamic Registration

Register commands at runtime:

Unregistering Commands

Remove commands from the manager:
Source: pkg/command/command.go:114-118

Best Practices

Always handle errors gracefully:
Use consistent permission naming:
  • gate.command.<name> for basic commands
  • gate.admin.<feature> for admin commands
  • myplugin.command.<name> for plugin commands
Validate arguments before use:

Next Steps

Brigadier Guide

Learn Brigadier’s advanced features

Complete Example

See a full command plugin