Last active
August 29, 2015 14:22
-
-
Save njb-said/b550b8555aa0948b1067 to your computer and use it in GitHub Desktop.
ping thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EventHandler | |
public void onPing(ProxyPingEvent e) { | |
ServerPing old = e.getResponse(); | |
ServerPing reply = new ServerPing(); | |
// this playerCount variable is not defined because you can get it yourself.. (or if you use redis/mysql to store online player count) | |
reply.setPlayers(new ServerPing.Players(playerCount + 1, playerCount, old.getPlayers().getSample())); | |
reply.setDescription("whatever motd you want"); | |
reply.setFavicon(favicon); | |
reply.setVersion(old.getVersion()); | |
e.setResponse(reply); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You probably should register intent as this is an async event, but this is a yolo gist 💥
Edit favicon and playerCount are not defined as variables because you might want to change them or get them from a database