Plugin Template
The fastest way to start building with Gate is to use our official plugin template. It provides a complete, working example with all the boilerplate configured.What’s Included
The gate-plugin-template repository includes:- Pre-configured Go module with Gate dependencies
- Example plugin code demonstrating common patterns
- Build configuration with Makefile
- Docker support for containerized deployments
- CI/CD examples for automated builds
- Documentation and code comments
Quick Start
Fork or Clone the Template
Visit the gate-plugin-template repository and fork it to your GitHub account, or clone it directly:
Install Dependencies
Download the required Go modules:This will fetch Gate and all its dependencies.
Explore the Code
Open
plugin.go to see the example plugin implementation. The template includes:- Plugin initialization hook
- Example command registration
- Event listener examples
- Common API usage patterns
Template Structure
The template is organized as follows:Key Files
plugin.go: Contains your plugin’s main logicCustomizing the Template
1. Update Module Name
Editgo.mod to reflect your project:
2. Rename Your Plugin
Inplugin.go, change the plugin name:
3. Add Your Features
Extend the initialization function to add your custom logic:Common Patterns
The template demonstrates several common patterns:Command Registration
Event Subscription
Accessing Player Data
Building for Production
Compile Optimized Binary
CGO_ENABLED=0: Disable C dependencies for pure Go binary-ldflags="-s -w": Strip debug info to reduce binary size
Cross-Compile for Linux
From macOS or Windows:Docker Build
The template includes a Dockerfile:Configuration Management
Environment Variables
Gate supports environment variable overrides:Custom Config Path
Config Validation
Gate validates your configuration on startup and logs any errors or warnings.Troubleshooting
Build Errors
Error: package go.minekube.com/gate is not in GOROOT
Error: package go.minekube.com/gate is not in GOROOT
Solution: Download dependencies first:
Error: cannot find module providing package
Error: cannot find module providing package
Solution: Update your go.mod and download missing packages:
Build succeeds but binary doesn't run
Build succeeds but binary doesn't run
Solution: Check for config.yml in the working directory:
Runtime Issues
Error: address already in use
Error: address already in use
Solution: Another process is using port 25565. Either stop it or change the port in config.yml:
Players can't connect to backend servers
Players can't connect to backend servers
Solution: Verify backend servers are running and accessible:Check your
config.yml server addresses are correct.Commands not working
Commands not working
Solution: Ensure commands are registered before Gate starts:
Updating Gate Version
To update to the latest Gate version:Next Steps
Now that you have the template running:Learn Commands
Register custom commands for your players
Handle Events
React to player actions and server events
View Examples
Study the complete simple-proxy example
API Reference
Explore the full API documentation
Resources
- Template Repository: github.com/minekube/gate-plugin-template
- Example Code: Simple Proxy Example
- Go Docs: pkg.go.dev/go.minekube.com/gate
- Community: Discord Server

