Skip to main content
This example demonstrates advanced command handling in Gate, including arguments, tab completion suggestions, and executing complex commands.

Overview

This example creates commands with:
  • String arguments with phrase support
  • Tab completion suggestions
  • Argument validation and parsing
  • Player-only command restrictions
  • Multiple argument types (literals, strings, integers)

Complete Example

Project Structure

go.mod

go.mod

main.go

main.go

Building and Running

Command Usage

Once running, try these commands in-game:

Key Features Explained

Argument Types

Tab Completion

Provide suggestions to help users:

Legacy Color Codes

Gate supports Minecraft’s legacy color codes (& format):
Common codes:
  • &0-9, a-f - Colors
  • &l - Bold
  • &m - Strikethrough
  • &n - Underline
  • &o - Italic
  • &r - Reset

Player-Only Commands

Restrict commands to players:

Command Context

Retrieve arguments from the command context:

Advanced Topics

Command Permissions

Add permission checks to commands

Brigadier API

Deep dive into Brigadier’s command system

Command Aliases

Register multiple names for commands

Custom Arguments

Create custom argument types

Next Steps

Always validate user input! Check that players exist, servers are available, and arguments are in valid ranges.