Skip to content

Instantly share code, notes, and snippets.

@daboross
Created November 8, 2013 06:39
Show Gist options
  • Save daboross/7367119 to your computer and use it in GitHub Desktop.
Save daboross/7367119 to your computer and use it in GitHub Desktop.
Proxy ping event to persuade players to use new IP.
@EventHandler
public void onPing(ProxyPingEvent evt) {
ServerPing ping = evt.getResponse();
InetSocketAddress hostAddress = evt.getConnection().getVirtualHost();
String host = hostAddress == null ? null : hostAddress.getHostString();
if (host != null && !host.contains("the-ip-you-should-use.net")) {
ping.setDescription("You aren't using the new IP! Be gone!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment