mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-28 05:05:21 +01:00
Close #300 - cleaner disconnects when server is full
This commit is contained in:
parent
5f8e76c61c
commit
140830efe0
@ -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() );
|
||||
@ -210,7 +214,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
Preconditions.checkState( thisState == State.LOGIN, "Not expecting LOGIN" );
|
||||
|
||||
UserConnection userCon = new UserConnection( (BungeeCord) bungee, ch,getName(), this );
|
||||
UserConnection userCon = new UserConnection( (BungeeCord) bungee, ch, getName(), this );
|
||||
userCon.init();
|
||||
|
||||
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
|
||||
|
Loading…
Reference in New Issue
Block a user