From 75ff73a45ceed9d8bdf09a1957fc125c3fbe88bd Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Sat, 14 Sep 2024 23:33:49 +0200 Subject: [PATCH] chown: reorder to first check if player has any factions at all There is no point in checking other params if this part fails. --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index d7f3b43..ec4387b 100644 --- a/init.lua +++ b/init.lua @@ -458,14 +458,14 @@ local function handle_command(name, param) local faction_name = nil local target = 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 return false, S("Missing password.") else return false, S("Missing player name.") 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 faction_name = own_factions[1] target = params[2]