Ability to set infinite number of connections

This commit is contained in:
Nanit 2021-11-01 21:33:32 +02:00
parent c6fcf0bf83
commit ebd6baf7b5
2 changed files with 3 additions and 1 deletions

View File

@ -139,7 +139,8 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
} }
if (packet instanceof PacketLoginStart) { if (packet instanceof PacketLoginStart) {
if (server.getConnections().getCount() >= server.getConfig().getMaxPlayers()) { if (server.getConfig().getMaxPlayers() > 0 &&
server.getConnections().getCount() >= server.getConfig().getMaxPlayers()) {
disconnectLogin("Too many players connected"); disconnectLogin("Too many players connected");
return; return;
} }

View File

@ -8,6 +8,7 @@ bind:
port: 65535 port: 65535
# Max amount of players can join to server # Max amount of players can join to server
# Set -1 to make it infinite
maxPlayers: 100 maxPlayers: 100
# Server's data in servers list # Server's data in servers list