Ban silently all the list, not only first player

This commit is contained in:
kay27 2022-03-14 13:23:09 +04:00
parent 7ca28d8a27
commit 2f7bb481ad
1 changed files with 12 additions and 13 deletions

View File

@ -199,11 +199,10 @@ local function step()
end end
end end
elseif #players < 26 then elseif #players < 26 then
if should_be_banned then
minetest.chat_send_all("Player " .. first .. " has been banned for having more than 9 connections at once")
minetest.ban_player(first)
else
for _, player_name in pairs(players) do for _, player_name in pairs(players) do
if should_be_banned then
minetest.ban_player(player_name)
else
if (player_doesnt_move[player_name] or 0) > 90/step_seconds then if (player_doesnt_move[player_name] or 0) > 90/step_seconds then
minetest.kick_player(player_name, "Didn't move during 1.5 minutes being connected multiple times") minetest.kick_player(player_name, "Didn't move during 1.5 minutes being connected multiple times")
ban_next_time[ip] = 1 ban_next_time[ip] = 1
@ -211,18 +210,18 @@ local function step()
end end
end end
elseif #players <= 100 then elseif #players <= 100 then
if should_be_banned then
minetest.ban_player(first)
minetest.chat_send_all("Player " .. first .. " has been banned for having more than 25 connections at once")
else
for _, player_name in pairs(players) do for _, player_name in pairs(players) do
if should_be_banned then
minetest.ban_player(player_name)
else
minetest.kick_player(player_name, "More than 25 connections from IP address " .. ip) minetest.kick_player(player_name, "More than 25 connections from IP address " .. ip)
end
ban_next_time[ip] = 1 ban_next_time[ip] = 1
end end
end
else else
minetest.ban_player(first) for _, player_name in pairs(players) do
minetest.chat_send_all("Player " .. first .. " has been banned for having more than 100 connections at once") minetest.ban_player(player_name)
end
end end
end end
end end