#1841: Fix disabled throttle and improve code.

This commit is contained in:
md_5 2016-04-24 22:18:23 +10:00
parent 2e8ed1cfba
commit 1cd3e42182
3 changed files with 6 additions and 3 deletions

View File

@ -270,7 +270,10 @@ public class BungeeCord extends ProxyServer
pluginManager.enablePlugins(); pluginManager.enablePlugins();
if ( config.getThrottle() > 0 )
{
connectionThrottle = new ConnectionThrottle( config.getThrottle() ); connectionThrottle = new ConnectionThrottle( config.getThrottle() );
}
startListeners(); startListeners();
saveThread.scheduleAtFixedRate( new TimerTask() saveThread.scheduleAtFixedRate( new TimerTask()

View File

@ -296,7 +296,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
thisState = State.USERNAME; thisState = State.USERNAME;
ch.setProtocol( Protocol.LOGIN ); ch.setProtocol( Protocol.LOGIN );
if ( bungee.getConnectionThrottle().throttle( ( (InetSocketAddress) ch.getHandle().remoteAddress() ).getAddress() ) ) if ( bungee.getConnectionThrottle() != null && bungee.getConnectionThrottle().throttle( getAddress().getAddress() ) )
{ {
disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( bungee.getConfig().getThrottle() ) ) ); disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( bungee.getConfig().getThrottle() ) ) );
} }