sillerud / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
http://www.spigotmc.org/threads/bungeecord.392/
Other
24 stars 25 forks source link

Implement proper ProxyPingEvent for 1.7.2 #2

Closed literalplus closed 10 years ago

literalplus commented 10 years ago

This pull request adds a proper ProxyPingEvent for 1.7.2 pings by adding a new class NewServerPing, which is used to represent a 1.7.2 equivalent of ServerPing. I have moved the Json logic there for readability. I have also modified the ProxyPingEvent to provide a boolean stating if the new protocol is used and providing a NewServerPing. To maintain compatibility with 1.6.4 Bungee plugins, the NewServerPing is converted to the 1.6.4 ServerPing in the constructor if it's a 1.7.2 event. If it's a 1.6.4 event, only the ServerPing is created. If a 1.6.4 plugin sets the response for a 1.7.2 event, the NewServerPing is updated.

Should be 100% compatible with 1.6.4 plugins!

This adds a google json dependency to api, adds a new Class NewServerPing to represent 1.7.2 ping responses, adds a method to ServerPing to convert into a NewServerPing object, moves json creation form InitialHandler to NewServerPing, adds event compatibility for 1.7.2 pings.

I have tested it, BungeeCord compiles and runs, my test plugin worked just fine and as intended.

I have not provided any more material as this repo does not contain a CONTRIBUTUING.md at the moment, but can adapt. (Especially names - It might be more accurate to name NewServerPing 172ServerPing, but this looks ugly :D)

Thanks for considering it.

literalplus commented 10 years ago

This has apparently been merged in some other way. f51c45f72eefa132b2433f59e298b2354c3cbde7