From 5c5292e48e07ab0e3b303c5ba804b84e8aa54d2d Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Tue, 3 Sep 2024 10:42:53 +0200 Subject: [PATCH] whitespace indentation fixup --- areas.lua | 226 +++++++++++++++++++++++++++--------------------------- 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/areas.lua b/areas.lua index b219959..3e2b58a 100644 --- a/areas.lua +++ b/areas.lua @@ -3,7 +3,7 @@ local xp_areas = {} function xp_redo.get_area_xp_limits(id) - return xp_areas[id] or {} + return xp_areas[id] or {} end -- protection check @@ -50,131 +50,131 @@ xp_areas = load_xp_areas() -- cleanup for removed areas areas:registerOnRemove(function(id) - xp_areas[id] = nil - save_xp_areas() + xp_areas[id] = nil + save_xp_areas() end) -- chat minetest.register_chatcommand("area_xp_set_max", { - params = " ", - description = "Set or clear the max-xp value of an area", - func = function(playername, param) - local matcher = param:gmatch("(%S+)") - local id_str = matcher() - local xp = matcher() - if id_str == nil then - return true, "Invalid syntax!" - end - - local id = tonumber(id_str) - if not id then - return true, "area-id is not numeric: " .. id_str - end - - if not areas:isAreaOwner(id, playername) and - not minetest.check_player_privs(playername, { protection_bypas = true }) - then - return true, "you are not the owner of area: " .. id - end - - local xp_area = xp_areas[id] - if not xp_area then - xp_area = {} - end - - xp_area.max = tonumber(xp) - xp_areas[id] = xp_area - save_xp_areas() - return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "") - end, + params = " ", + description = "Set or clear the max-xp value of an area", + func = function(playername, param) + local matcher = param:gmatch("(%S+)") + local id_str = matcher() + local xp = matcher() + if id_str == nil then + return true, "Invalid syntax!" + end + + local id = tonumber(id_str) + if not id then + return true, "area-id is not numeric: " .. id_str + end + + if not areas:isAreaOwner(id, playername) and + not minetest.check_player_privs(playername, { protection_bypas = true }) + then + return true, "you are not the owner of area: " .. id + end + + local xp_area = xp_areas[id] + if not xp_area then + xp_area = {} + end + + xp_area.max = tonumber(xp) + xp_areas[id] = xp_area + save_xp_areas() + return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "") + end, }) minetest.register_chatcommand("area_xp_get_max", { - params = "", - description = "Returns the max-xp value of an area", - func = function(playername, param) - if param == nil then - return true, "Invalid syntax!" - end - - local id = tonumber(param) - if not id then - return true, "area-id is not numeric: " .. param - end - - if not areas:isAreaOwner(id, playername) and - not minetest.check_player_privs(playername, { protection_bypas = true }) - then - return true, "you are not the owner of area: " .. id - end - - local xp_area = xp_areas[id] - if not xp_area then - xp_area = {} - end - - return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "") - end, + params = "", + description = "Returns the max-xp value of an area", + func = function(playername, param) + if param == nil then + return true, "Invalid syntax!" + end + + local id = tonumber(param) + if not id then + return true, "area-id is not numeric: " .. param + end + + if not areas:isAreaOwner(id, playername) and + not minetest.check_player_privs(playername, { protection_bypas = true }) + then + return true, "you are not the owner of area: " .. id + end + + local xp_area = xp_areas[id] + if not xp_area then + xp_area = {} + end + + return true, "Area " .. id .. " max-xp value: " .. (xp_area.max or "") + end, }) minetest.register_chatcommand("area_xp_set_min", { - params = " ", - description = "Set or clear the min-xp value of an area", - func = function(playername, param) - local matcher = param:gmatch("(%S+)") - local id_str = matcher() - local xp = matcher() - if id_str == nil then - return true, "Invalid syntax!" - end - - local id = tonumber(id_str) - if not id then - return true, "area-id is not numeric: " .. id_str - end - - if not areas:isAreaOwner(id, playername) and - not minetest.check_player_privs(playername, { protection_bypas=true }) then - return true, "you are not the owner of area: " .. id - end - - local xp_area = xp_areas[id] - if not xp_area then - xp_area = {} - end - - xp_area.min = tonumber(xp) - xp_areas[id] = xp_area - save_xp_areas() - return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "") - end, + params = " ", + description = "Set or clear the min-xp value of an area", + func = function(playername, param) + local matcher = param:gmatch("(%S+)") + local id_str = matcher() + local xp = matcher() + if id_str == nil then + return true, "Invalid syntax!" + end + + local id = tonumber(id_str) + if not id then + return true, "area-id is not numeric: " .. id_str + end + + if not areas:isAreaOwner(id, playername) and + not minetest.check_player_privs(playername, { protection_bypas=true }) then + return true, "you are not the owner of area: " .. id + end + + local xp_area = xp_areas[id] + if not xp_area then + xp_area = {} + end + + xp_area.min = tonumber(xp) + xp_areas[id] = xp_area + save_xp_areas() + return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "") + end, }) minetest.register_chatcommand("area_xp_get_min", { - params = "", - description = "Returns the min-xp value of an area", - func = function(playername, param) - if param == nil then - return true, "Invalid syntax!" - end - - local id = tonumber(param) - if not id then - return true, "area-id is not numeric: " .. param - end - - if not areas:isAreaOwner(id, playername) and - not minetest.check_player_privs(playername, { protection_bypas=true }) then - return true, "you are not the owner of area: " .. id - end - - local xp_area = xp_areas[id] - if not xp_area then - xp_area = {} - end - - return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "") - end, + params = "", + description = "Returns the min-xp value of an area", + func = function(playername, param) + if param == nil then + return true, "Invalid syntax!" + end + + local id = tonumber(param) + if not id then + return true, "area-id is not numeric: " .. param + end + + if not areas:isAreaOwner(id, playername) and + not minetest.check_player_privs(playername, { protection_bypas=true }) then + return true, "you are not the owner of area: " .. id + end + + local xp_area = xp_areas[id] + if not xp_area then + xp_area = {} + end + + return true, "Area " .. id .. " min-xp value: " .. (xp_area.min or "") + end, })