🚪 SpongyCord - A simple wrapper API for Bungee

SpongyCord

##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:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile "com.github.pie-flavor:SpongyCord:1.1.0"
}

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.

Source

Link

Download

1.0.0
1.1.0
1.1.1

##Changelog
1.0.0: Initial release.
1.1.0: Renamed project to SpongyCord.
1.1.1: Fixed a bug with ConnectOther.

4 Likes

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.

1 Like

You could also return CompletableFutures, which allow to both call the classical get and to use callbacks.

3 Likes

This is prone to a whole lot of failure, though, and if someone badly writes a plugin, it could be hard to trace. This was also easier to write.

I have a request: Please don’t include “Sponge” in your plugin name.
We reserve the use of Sponge in titles for official SpongePowered works.

Sorry to be a wet sponge :wink:

2 Likes

Sponge+Bungee=Spongee
I can’t think of anything else to title it. Perhaps our professional wordwrangler can.

how about “Squeegee - cleaning up Bungee’s act?”

2 Likes

According to our new (WIP) guidelines, the following should be allowable:

  • ServerStrap
  • BungeeCrust
  • PieCord
  • YoYo
  • Cowabungee
  • SpongyCord
  • PoriFerry
  • Causeway
  • ElasticBridge
  • AbsorBungee
  • FLARDconnect

I hope that helps :wink:

doop de doo

1 Like

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.

5 Likes

I second this suggestion

Is this a alternative to BungeeCord or does this goes into the Mod folder?

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.

i put that right at the top for a reason.

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?

Pretty sure nothing has changed in the API that would break this plugin. Last tests I did with Project Portals had no problems

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)