StarGate Plugins

Guide thought plugin configuration and usage.

Server Setup

Configuring and starting default StarGate server shouldn't be problem. StarGate server comes as plugin for Bungeecord (and its forks) and for WaterdogPE. Both plugins use similar or same API methods and use same config file.

Server Plugin

StarGate server is used to handle new pending connections, route/handle incoming packets from the clients. Service uses tcp sockets, by default port 47007 is used.
You should include StarGate plugin into dependencies of your plugin inside of plugin.yml file. Your plugin will be than enabled after server plugin.


This is how default config should look like.

# On this port StarGate server will listen for new connections.
serverPort: 47007
# To make connection secure enough set strong password that will be used to authenticate clients.
password: "123456789"
# Clients should not have same name and should be same as name of downstream server.
# Disabling this option will allow to join more clients using same client name.
# If enabled, some packets that use client name to identify client, might not work.
blockSameNames: true
# Enable debug logger
debug: true

Server Events

Plugins can use events to handle new connected, authenticated or disconnected session. Here is simple overview of currently available events.

Registering packets

Assuming your plugin is enabled after StarGate server plugin, you can register custom packets inside of onEnable() method.

ProtocolCodec codec = StarGate.getInstance().getServer().getProtocolCodec();
codec.registerPacket(StarGatePackets.SERVER_INFO_REQUEST_PACKET, ServerInfoRequestPacket.class);

Implementing Own Server

To create new server instance you should create new class which will implement ServerLoader. Currently, it is used only to provide own StarGateLogger implementation. Using public StarGateServer(bindAddress : InetSocketAddress, password : String, loader : ServerLoader) constructor we create new server instance. To start server we use StarGateServer#start().
Simple example:

MyServerLoader loader = new MyServerLoader();
InetSocketAddress address = new InetSocketAddress("", 47007);
StarGateServer server = new StarGateServer(address, "12345", loader);
// You can register custom packets here

Client Setup

Client is used to communicate with StarGate server. In Minecraft environment, we know clients as plugin for server. Stargate comes with default implementation of clients for:

Plugin Configuration

Server clients use same configuration file:

# Supports more connections
    port: 47007
    password: 123456789

# Enable debug logger
debug: true
# Change log level to log packets in debug mode.
logLevel: 0
# Default client will be used if no clientName specified in api functions
defaultClient: "lobby1"
# Start clients after plugin is enabled.
autoStart: true
# Interval in ticks to receive data from connection
tickInterval: 2

Session Events

Plugin Methods

Plugins for all platforms expose these common methods:


StarGate Universe contains Java client implementations. Currently supporting only NukkitX client.


Use Maven dependency in your plugin (see below). You should probably include StarGate Common dependency aswell.


You should also include StarGate-Universe in plugin.yml dependencies list.
Latest build can be found on Waterdog jenkins server, artifacts are uploaded to Waterdog repository server.

To access plugin instance we can use StarGateUniverse plugin = StarGate.getInstance().
If you have disabled autoStart option in config, you can start all clients like below:

StarGateUniverse plugin = StarGate.getInstance()
for (StarGateClient client : plugin.getClientsCopy()){
  // You can adjust ProtocolCodec here


StarGate Atlantis is client implementation based on PHP created for PocketMine-MP (currently version 3 only). To make your IDE index plugin classes you can use phar file obtained from Poggit and include it as dependency.

To access plugin instance we can use $plugin = StarGateAtlantis::getInstance().
If you have disabled autoStart option in config, you can start all clients like below:

$plugin = StarGateAtlantis::getInstance()
foreach ($plugin->getClients() as $client){
  // You can adjust ProtocolCodec here