Close #300 - cleaner disconnects when server is full

This commit is contained in:
md_5 2013-05-03 14:16:48 +10:00
parent 5f8e76c61c
commit 140830efe0

View File

@ -109,7 +109,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
int limit = BungeeCord.getInstance().config.getPlayerLimit();
Preconditions.checkState( limit <= 0 || bungee.getPlayers().size() < limit, "Server is full!" );
if ( limit > 0 && bungee.getPlayers().size() > limit )
{
disconnect( "Server is full!" );
return;
}
this.handshake = handshake;
ch.write( request = EncryptionUtil.encryptRequest() );