mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 22:24:18 +01:00
Close #474 - 1.5 ping to 1.6 bungee
This commit is contained in:
parent
5c4ea3c7a0
commit
06e732d8c7
@ -142,25 +142,31 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
|
||||
private void respondToPing()
|
||||
{
|
||||
ServerInfo forced = AbstractReconnectManager.getForcedHost( this );
|
||||
String motd = listener.getMotd();
|
||||
if ( forced != null )
|
||||
try
|
||||
{
|
||||
motd = forced.getMotd();
|
||||
ServerInfo forced = AbstractReconnectManager.getForcedHost( this );
|
||||
String motd = listener.getMotd();
|
||||
if ( forced != null )
|
||||
{
|
||||
motd = forced.getMotd();
|
||||
}
|
||||
|
||||
ServerPing response = new ServerPing( bungee.getProtocolVersion(), bungee.getGameVersion(),
|
||||
listener.getMotd(), bungee.getOnlineCount(), listener.getMaxPlayers() );
|
||||
|
||||
response = bungee.getPluginManager().callEvent( new ProxyPingEvent( InitialHandler.this, response ) ).getResponse();
|
||||
|
||||
String kickMessage = ChatColor.DARK_BLUE
|
||||
+ "\00" + response.getProtocolVersion()
|
||||
+ "\00" + response.getGameVersion()
|
||||
+ "\00" + response.getMotd()
|
||||
+ "\00" + response.getCurrentPlayers()
|
||||
+ "\00" + response.getMaxPlayers();
|
||||
disconnect( kickMessage );
|
||||
} catch ( Throwable t )
|
||||
{
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
ServerPing response = new ServerPing( bungee.getProtocolVersion(), bungee.getGameVersion(),
|
||||
listener.getMotd(), bungee.getOnlineCount(), listener.getMaxPlayers() );
|
||||
|
||||
response = bungee.getPluginManager().callEvent( new ProxyPingEvent( InitialHandler.this, response ) ).getResponse();
|
||||
|
||||
String kickMessage = ChatColor.DARK_BLUE
|
||||
+ "\00" + response.getProtocolVersion()
|
||||
+ "\00" + response.getGameVersion()
|
||||
+ "\00" + response.getMotd()
|
||||
+ "\00" + response.getCurrentPlayers()
|
||||
+ "\00" + response.getMaxPlayers();
|
||||
disconnect( kickMessage );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -173,7 +179,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
respondToPing();
|
||||
}
|
||||
}, 1000, TimeUnit.MILLISECONDS );
|
||||
}, 500, TimeUnit.MILLISECONDS );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,6 +30,11 @@ public abstract class AbstractReconnectManager implements ReconnectHandler
|
||||
|
||||
public static ServerInfo getForcedHost(PendingConnection con)
|
||||
{
|
||||
if ( con.getVirtualHost() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String forced = con.getListener().getForcedHosts().get( con.getVirtualHost().getHostString() );
|
||||
|
||||
if ( forced == null && con.getListener().isForceDefault() )
|
||||
|
Loading…
Reference in New Issue
Block a user