@Override
public void done(ServerPing result, Throwable error)
{
if ( error != null )
{
result = new ServerPing();
result.setDescription( bungee.getTranslation( "ping_cannot_connect" ) );
bungee.getLogger().log( Level.WARNING, "Error pinging remote server", error );
}
Callback<ProxyPingEvent> callback = new Callback<ProxyPingEvent>()
{
@Override
public void done(ProxyPingEvent pingResult, Throwable error)
{
BungeeCord.getInstance().getConnectionThrottle().unthrottle( getAddress().getAddress() );
Gson gson = handshake.getProtocolVersion() == ProtocolConstants.MINECRAFT_1_7_2 ? BungeeCord.getInstance().gsonLegacy : BungeeCord.getInstance().gson;
unsafe.sendPacket( new StatusResponse( gson.toJson( pingResult.getResponse() ) ) );
}
};
bungee.getPluginManager().callEvent( new ProxyPingEvent( InitialHandler.this, result, callback ) );
}
};
if ( forced != null && listener.isPingPassthrough() )
{
( (BungeeServerInfo) forced ).ping( pingBack, handshake.getProtocolVersion() );
} else
{
int protocol = ( Protocol.supportedVersions.contains( handshake.getProtocolVersion() ) ) ? handshake.getProtocolVersion() : bungee.getProtocolVersion();
pingBack.done( new ServerPing(
new ServerPing.Protocol( bungee.getName() + " " + bungee.getGameVersion(), protocol ),
new ServerPing.Players( listener.getMaxPlayers(), bungee.getOnlineCount(), null ),
motd, BungeeCord.getInstance().config.getFaviconObject() ),
null );
}