Show list members only if the members are less than 50 in the /factions info command

This commit is contained in:
Supergoat666 2020-07-29 09:28:33 +02:00
parent 7d77eb3a41
commit 0b799f3c5f

@ -240,6 +240,9 @@ local function handle_command(name, param)
minetest.chat_send_player(name, S("This faction is not registered")) minetest.chat_send_player(name, S("This faction is not registered"))
else else
local fmembers = "" local fmembers = ""
if table.getn(facts[faction_name].members) > 50 then
fmembers = "The faction has more than 50 members, the members list can't be shown"
elseif
for play,_ in pairs(facts[faction_name].members) do for play,_ in pairs(facts[faction_name].members) do
if fmembers == "" then if fmembers == "" then
fmembers = play fmembers = play
@ -247,6 +250,7 @@ local function handle_command(name, param)
fmembers = fmembers..", "..play fmembers = fmembers..", "..play
end end
end end
end
minetest.chat_send_player(name, S("Name: @1\nOwner: @2\nMembers: @3", faction_name, factions.get_owner(faction_name), fmembers)) minetest.chat_send_player(name, S("Name: @1\nOwner: @2\nMembers: @3", faction_name, factions.get_owner(faction_name), fmembers))
if factions.get_owner(faction_name) == name or minetest.get_player_privs(name).playerfactions_admin then if factions.get_owner(faction_name) == name or minetest.get_player_privs(name).playerfactions_admin then
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name))) minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name)))