HomeJavaModsMinigame Communications Framework
Minigame Communications Framework
Minigames Communication Framework
This framework is designed to provide an interface for users to join minigames running on other servers; the same way in which many servers have a game lobby and you can click on signs to join a server.

The framework consists of two plugins, a hub plugin designed to run on your lobby server which manages the signs and all incoming connections, and an instance plugin, designed to run on each minigame server.

To utilise this framework, all you need to do is place the hub plugin on your lobby server and then place the instance plugin on each minigame server. Your minigame has to make a simple hook to the instance plugin and you are ready to go.

MinigameComms-Hub (Hub Plugin)

All commands must be executed in-game and require the permission minigamecomms.admin.

Commands

/comms create <server-id>

You must be looking at a sign when you execute this command. It will create a sign which users can interact with to join a minigame server, the server ID must match the BungeeCord server name of one of your defined minigame instances.

/comms delete <server-id>

Simply delete a registered server sign, the sign will be cleared after you execute this command.

/comms list

View a list of registered server ID's.
C onfiguration
The configuration comes preloaded with a number of defined sign formats for various game states, including: lobby, in-game, loading and offline. These support colour codes preceeded by the ampersand (&) character.

There are a number of dynamic variables you can use which will be updated in real-time and these are as follows:
A few more specific configuration options are seen below.
Code (Text):
#to avoid using passwords, the hub will only accept connections from the following defined hosts, if you are running minigame instances on a different server make sure you add the relevant IP to this list.
allow:
  hosts:
  - 127.0.0.1

#the port to listen for connection on, leave this as it is unless you want to use a specific port
port:
  bind: 34560

#If we have not received data from a server after the number of seconds defined here we will treat it as offline. All of your minigame instances should send data more frequently than the number of seconds defined to prevent them being treated as offline.
consider:
  offline:
    nocomms:
      seconds: 15

MinigameComms-Instance (Instance Plugin)

The configuration for each minigame instance plugin is more straightforward, and for the most part self-explanatory but here's an explanation of each option for clarity.

Code (Text):
bungee:
  server:
    #the name of this server, as defined in your bungeecord configuration
    name: skywars1

minigame:
  comms:
    #the IP address of the server on which the hub plugin is running
    host: 127.0.0.1
    #the port on which the hub server is listening on
    port: 34560
    reconnect:
      delay:
        #after a failed connection, how many seconds to wait before trying again
        seconds: 15
    update:
      frequency:
        #How often to send updates to the hub plugin, I HIGHLY recommend leaving this at 1 second so your signs update in real-time. This value should always be smaller than your offline consideration configuration option in the hub plugin.
        seconds: 1
 
This plugin handles almost everything with contacting the hub server, but to utilise it you have to register a handler.

Also, make sure you minigame depends on this plugin so that it loads in the correct order, you can do so by putting the following in your plugin.yml.
Code (Text):
depend: [MinigameComms-Instance]
After adding the MinigameComms-Instance.jar plugin to your build path you can register a handler as follows.

Code (Text):
Comms.registerHandler(this, new MinigamePayload() {
            @Override
            //get the number of online players, as defined by your plugin, eg: Bukkit.getOnlinePlayers().size() - spectators or Bukkit.getOnlinePlayers().size()
            public int getPlayersOnline() {
                return Bukkit.getOnlinePlayers().size();
            }

            @Override
            //return the maximum number of players as defined by your minigame, eg: MyGame.getMaxPlayers()
            public int getMaxPlayers() {
                return Config.getMaxPlayers();
            }

            @Override
            public GameState getGameState() {
                //return the current game state, it has to be either LOBBY or GAME
                return MyGame.started ? GameState.GAME : GameState.LOBBY;
            }

            @Override
            public void connectionFailed() {
                //you can do something specific if a connection to the hub server fails, but normally you will probably want to leave this blank
            }

            @Override
            public void connectionSuccess() {
                //you can do something specific if a connection to the hub server is successful, but normally you will probably want to leave this blank
            }
        });
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Minigame Communications Framework is a free Minecraft Java mod. Downloaded 265 times (via Spigot). Download it and open it directly in the game.

Explore more