Proxy type is Gate’s main Java edition Minecraft proxy interface. It provides methods for managing servers, players, commands, and events.
Overview
The Proxy is the central component that:- Manages backend server registrations
- Tracks connected players
- Handles event management
- Processes commands
- Controls the proxy lifecycle
pkg/edition/java/proxy/proxy.go:42
Creating a Proxy
Create a new proxy instance with configuration:*config.Config
required
The proxy configuration. Must be validated before passing.
event.Manager
Event manager for the proxy. If nil, no events are sent.
auth.Authenticator
Custom authenticator for online mode. If nil, uses Mojang’s session server.
Starting the Proxy
Start the proxy and begin accepting connections:error
Returns
ErrProxyAlreadyRun if the proxy was already started, or any initialization/runtime errors.A Proxy instance can only be run once. Create a new instance to restart.
Server Management
Registering Servers
Register a backend server with the proxy:ServerInfo
required
Server information including name and address.
RegisteredServer
The registered server instance.
error
Returns
ErrServerAlreadyExists if a server with the same name already exists.Getting Servers
Retrieve registered servers:RegisteredServer
Returns nil if the server is not found.
Unregistering Servers
Remove a server from the proxy:bool
Returns true if the server was found and unregistered.
Player Management
Getting Players
Retrieve connected players:Player
Returns nil if the player is not found.
Disconnecting Players
Disconnect all connected players:component.Component
The disconnect reason to display to players.
Event Management
Access the proxy’s event manager:event.Manager
The proxy’s event manager for subscribing to and firing events.
Command Management
Access the proxy’s command manager:*command.Manager
The proxy’s command manager for registering and managing commands.
Configuration
Access the current proxy configuration:config.Config
A copy of the current proxy configuration.
Shutdown
Shutdown the proxy gracefully:- Stops listening for new connections
- Fires
PreShutdownEventallowing modification of disconnect reason - Disconnects all players with the provided reason
- Fires
ShutdownEventand waits for all event handlers - Cleans up resources
component.Component
The reason to display to players when disconnecting. Pass nil for blank reason.
Lite Mode
Access lite mode functionality:*lite.Lite
The proxy’s lite mode functionality handler.
Plugin Channel Registry
Access the plugin message channel registrar:*message.ChannelRegistrar
The channel registrar for plugin messages.
Complete Example
See Also
- Player API - Working with connected players
- Server API - Managing backend servers
- Connection API - Server connection management
- Events Guide - Event system documentation

