Add the member list in /faction info

This commit is contained in:
Supergoat666 2020-07-28 22:29:38 +02:00
parent d9844f27e4
commit 8e4aa0db51

@ -160,18 +160,29 @@ local function handle_command(name, param)
end end
return true return true
elseif action == "info" then elseif action == "info" then
local faction_name = params[2] local faction_name = params[2]
if faction_name == nil then if faction_name == nil then
faction_name = factions.get_player_faction(name) faction_name = factions.get_player_faction(name)
end minetest.chat_send_player(name, S("No faction were given, returning information about your oldest faction (e.g. the oldest created faction you are in)"))
if faction_name == nil then end
minetest.chat_send_player(name, S("Missing faction name")) if faction_name == nil then
else minetest.chat_send_player(name, S("Missing faction name"))
minetest.chat_send_player(name, S("Owner: @1", factions.get_owner(faction_name))) elseif facts[faction_name] == nil then
if factions.get_owner(faction_name) == name then minetest.chat_send_player(name, S("This faction is not registered"))
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name))) else
local fmembers = ""
for play,_ in pairs(facts[faction_name].members) do
if fmembers == "" then
fmembers = play
else
fmembers = fmembers..", "..play
end end
end end
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 then
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name)))
end
end
elseif action == "join" then elseif action == "join" then
local faction_name = params[2] local faction_name = params[2]
local password = params[3] local password = params[3]