mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-28 05:05:21 +01:00
Add global slot limit. Fixes feature request #40
This commit is contained in:
parent
9bf6a58ba2
commit
ec1de0f636
@ -48,7 +48,7 @@ public class Configuration
|
|||||||
* Should we check minecraft.net auth.
|
* Should we check minecraft.net auth.
|
||||||
*/
|
*/
|
||||||
private boolean onlineMode = true;
|
private boolean onlineMode = true;
|
||||||
private int sleepTime = 1;
|
private int playerLimit = -1;
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ public class Configuration
|
|||||||
timeout = adapter.getInt( "timeout", timeout );
|
timeout = adapter.getInt( "timeout", timeout );
|
||||||
uuid = adapter.getString( "stats", uuid );
|
uuid = adapter.getString( "stats", uuid );
|
||||||
onlineMode = adapter.getBoolean( "online_mode", onlineMode );
|
onlineMode = adapter.getBoolean( "online_mode", onlineMode );
|
||||||
sleepTime = adapter.getInt( "sleep_time", sleepTime );
|
playerLimit = adapter.getInt( "player_limit", playerLimit );
|
||||||
|
|
||||||
DefaultTabList tab = DefaultTabList.valueOf( adapter.getString( "tab_list", "GLOBAL_PING" ) );
|
DefaultTabList tab = DefaultTabList.valueOf( adapter.getString( "tab_list", "GLOBAL_PING" ) );
|
||||||
if ( tab == null )
|
if ( tab == null )
|
||||||
|
@ -117,6 +117,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
{
|
{
|
||||||
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
|
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
|
||||||
Preconditions.checkArgument( handshake.username.length() <= 16, "Cannot have username longer than 16 characters" );
|
Preconditions.checkArgument( handshake.username.length() <= 16, "Cannot have username longer than 16 characters" );
|
||||||
|
|
||||||
|
int limit = BungeeCord.getInstance().config.getPlayerLimit();
|
||||||
|
Preconditions.checkState( limit <= 0 || bungee.getPlayers().size() < limit, "Server is full!" );
|
||||||
|
|
||||||
this.handshake = handshake;
|
this.handshake = handshake;
|
||||||
ch.write( forgeMods );
|
ch.write( forgeMods );
|
||||||
ch.write( request = EncryptionUtil.encryptRequest() );
|
ch.write( request = EncryptionUtil.encryptRequest() );
|
||||||
|
Loading…
Reference in New Issue
Block a user