chown: reorder to first check if player has any factions at all

There is no point in checking other params if this part fails.
This commit is contained in:
Luke aka SwissalpS 2024-09-14 23:33:49 +02:00
parent 442c2c5209
commit 75ff73a45c

@ -458,14 +458,14 @@ local function handle_command(name, param)
local faction_name = nil local faction_name = nil
local target = nil local target = nil
local password = nil local password = nil
if #params < 3 then if number_factions == 0 then
return false, S("You are the owner of no faction, you can't use this command.")
elseif #params < 3 then
if params[2] ~= nil and minetest.player_exists(params[2]) then if params[2] ~= nil and minetest.player_exists(params[2]) then
return false, S("Missing password.") return false, S("Missing password.")
else else
return false, S("Missing player name.") return false, S("Missing player name.")
end end
elseif number_factions == 0 then
return false, S("You are the owner of no faction, you can't use this command.")
elseif number_factions == 1 and #params == 3 then elseif number_factions == 1 and #params == 3 then
faction_name = own_factions[1] faction_name = own_factions[1]
target = params[2] target = params[2]