Close #474 - 1.5 ping to 1.6 bungee

This commit is contained in:
md_5 2013-07-01 21:20:18 +10:00
parent 5c4ea3c7a0
commit 06e732d8c7
2 changed files with 29 additions and 18 deletions

View File

@ -142,25 +142,31 @@ public class InitialHandler extends PacketHandler implements PendingConnection
private void respondToPing() private void respondToPing()
{ {
ServerInfo forced = AbstractReconnectManager.getForcedHost( this ); try
String motd = listener.getMotd();
if ( forced != null )
{ {
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 @Override
@ -173,7 +179,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
respondToPing(); respondToPing();
} }
}, 1000, TimeUnit.MILLISECONDS ); }, 500, TimeUnit.MILLISECONDS );
} }
@Override @Override

View File

@ -30,6 +30,11 @@ public abstract class AbstractReconnectManager implements ReconnectHandler
public static ServerInfo getForcedHost(PendingConnection con) public static ServerInfo getForcedHost(PendingConnection con)
{ {
if ( con.getVirtualHost() == null )
{
return null;
}
String forced = con.getListener().getForcedHosts().get( con.getVirtualHost().getHostString() ); String forced = con.getListener().getForcedHosts().get( con.getVirtualHost().getHostString() );
if ( forced == null && con.getListener().isForceDefault() ) if ( forced == null && con.getListener().isForceDefault() )