##What is this? (for plebs)
This is a utility plugin. Other plugins will depend on this. If you don’t have any plugins that require this, you will have zero use for this plugin.
##What is this? (for devs)
Bungee has a convoluted plugin message system that they call an API. This is a much simpler API, with actual methods, that are wrappers around the plugin message logic.
##Okay, but what can I do with this?
You can:
Connect players to other servers
Get the real IP of any player on the network
Get the amount of players on one server, or on all the servers
Get a player list from one server, or all the servers
Get the name of the server you are on
Send a message to any player on the network
Send any server or client another plugin message
Get the real UUID of any player on the network
Get the server IP of any networked server
Kick any player on the network
##Hold on, some of these method signatures look weird.
Yeahh… about that… Because there’s still no way of interfacing with Bungee other than plugin messages, the reply is not instantaneous. Most likely, any requested information will arrive on the next tick. This is why all of the methods are void, and some take Consumers. Also, for anyone wondering why I don’t just return Future, the get() is blocking. It would block the single thread Minecraft runs on, the thread that would deliver the requested information. i.e. it would never arrive.
##How do I use such an awesome and well-made API in my plugin?
Add this to your build.gradle:
Not gonna provide a maven example cuz maven is for nerds.
Every method you need is found in SpongyCord.API. All method calls will throw exceptions if GameStartingServerEvent hasn’t happened yet.
The get is supposed to be blocking on futures, the idea being that if you are calling .get() you absolutely can not progress until it’s resolved.
If you are able to wait, they should be calling .get() in an async task, calling your methods in an async task, or poll the future in a sync task to see if it resolves.
For some reason this really feels like something that should be part of the sponge API itself, not a plugin.
I imagine this plugin could work very similarily to the Economy API, which is a service interface that a plugin can implement. That way, plugins could use a single interface to talk to a proxy server and a connector plugin could implement that interface. This also gives the added benefit of multiple plugins implementing the interface for different proxy servers, such as bungee or lilypad, for example.
This is a Sponge mod to help other plugins interact with BungeeCord. Unless a plugin that your’re using specifically says that it requires SpongyCord, you don’t need it.
Is this still usable? I’ve got a few SpongeForge servers running on my BungeeNetwork and a few of my plugins offer support for SpongyCord so i’m wondering if this is still up to date?
SpongyCord works fine on SpongeForge API 6.1 build 2378
(At least it doesn’t throw any errors during server start…)
(So does ProjectPortals/ProjectCore)