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
return true
elseif action == "info" then
local faction_name = params[2]
if faction_name == nil then
faction_name = factions.get_player_faction(name)
end
if faction_name == nil then
minetest.chat_send_player(name, S("Missing faction name"))
else
minetest.chat_send_player(name, S("Owner: @1", factions.get_owner(faction_name)))
if factions.get_owner(faction_name) == name then
minetest.chat_send_player(name, S("Password: @1", factions.get_password(faction_name)))
local faction_name = params[2]
if faction_name == nil then
faction_name = factions.get_player_faction(name)
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)"))
end
if faction_name == nil then
minetest.chat_send_player(name, S("Missing faction name"))
elseif facts[faction_name] == nil then
minetest.chat_send_player(name, S("This faction is not registered"))
else
local fmembers = ""
for play,_ in pairs(facts[faction_name].members) do
if fmembers == "" then
fmembers = play
else
fmembers = fmembers..", "..play
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
local faction_name = params[2]
local password = params[3]