mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Fixed potential mass-kick
This would happen if an admin joins the game when the server is full
This commit is contained in:
parent
bed78248fb
commit
808e02f660
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Sun Dec 01 17:31:33 CET 2013
|
||||
build.number=648
|
||||
#Sun Dec 01 18:16:33 CET 2013
|
||||
build.number=650
|
||||
|
@ -326,23 +326,25 @@ public class TFM_ServerInterface
|
||||
}
|
||||
}
|
||||
|
||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
||||
int count = server.getOnlinePlayers().length;
|
||||
if (count >= server.getMaxPlayers())
|
||||
{
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||
{
|
||||
p.kickPlayer("You have been kicked to free up room for an admin.");
|
||||
count--;
|
||||
}
|
||||
|
||||
if (server.getOnlinePlayers().length < server.getMaxPlayers())
|
||||
if (count < server.getMaxPlayers())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers())
|
||||
if (count >= server.getMaxPlayers())
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "The server is full and a player could not be kicked, sorry!");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user