diff --git a/README.md b/README.md index 00d0854..f0aeb27 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,7 @@ License ------- Copyright (C) 2013 ShadowNinja -Copyright (C) 2019 MultiCraft Development Team +Copyright (C) 2019-2020 MultiCraft Development Team Licensed under the GNU LGPL version 3.0 or later. See https://www.gnu.org/licenses/lgpl-3.0.txt - diff --git a/chatcommands.lua b/chatcommands.lua index 4924c87..d5ff96e 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -3,10 +3,10 @@ minetest.register_chatcommand("protect", { description = "Protect your own area", privs = {[areas.config.self_protection_privilege]=true}, func = function(name, param) - - minetest.log("warning", "/protect invoked, owner="..name.. - " AreaName="..param) - + + minetest.log("warning", "/protect invoked, owner = " .. name .. + " AreaName = " .. param) + if param == "" then return false, "Invalid usage, see /help protect." end @@ -184,10 +184,10 @@ minetest.register_chatcommand("find_areas", { minetest.register_chatcommand("list_areas", { description = "List your areas, or all areas if you are an admin.", func = function(name, param) - - minetest.log("warning", "/list_areas invoked, owner="..name.. - " AreaName="..param) - + + minetest.log("warning", "/list_areas invoked, owner = " .. name .. + " AreaName = " .. param) + local admin = minetest.check_player_privs(name, areas.adminPrivs) local areaStrings = {} for id, area in pairs(areas.areas) do @@ -233,10 +233,10 @@ minetest.register_chatcommand("remove_area", { description = "Remove an area using an ID", func = function(name, param) local id = tonumber(param) - - minetest.log("warning", "/remove_area invoked, owner="..name.. - " AreaName="..param) - + + minetest.log("warning", "/remove_area invoked, owner = " .. name.. + " AreaName = " .. param) + if not id then return false, "Invalid usage, see /help remove_area" end @@ -421,4 +421,3 @@ minetest.register_chatcommand("area_info", { return true, table.concat(lines, "\n") end, }) - diff --git a/internal.lua b/internal.lua index 6a2de6a..b26a977 100644 --- a/internal.lua +++ b/internal.lua @@ -46,7 +46,7 @@ end function areas:checkAreaStoreId(sid) if not sid then minetest.log("error", "AreaStore failed to find an ID for an " - .."area! Falling back to iterative area checking.") + .. "area! Falling back to iterative area checking.") self.store = nil self.store_ids = nil end @@ -237,7 +237,7 @@ function areas:canPlayerAddArea(pos1, pos2, name) self.config.self_protection_max_areas if count >= max_areas then return false, "You have reached the maximum amount of" - .." areas that you are allowed to protect." + .. " areas that you are allowed to protect." end -- Check intersecting areas diff --git a/settings.lua b/settings.lua index da2b534..2cc857e 100644 --- a/settings.lua +++ b/settings.lua @@ -3,7 +3,7 @@ local world_path = minetest.get_worldpath() areas.config = {} local function setting(tp, name, default) - local full_name = "areas."..name + local full_name = "areas." .. name local value if tp == "boolean" then value = minetest.settings:get_bool(full_name) @@ -14,8 +14,9 @@ local function setting(tp, name, default) elseif tp == "number" then value = tonumber(minetest.settings:get(full_name)) else - error("Invalid setting type!") + error("Cannot parse setting type " .. tp) end + if value == nil then value = default end @@ -37,6 +38,3 @@ setting("number", "self_protection_max_areas", 4) -- For players with the areas_high_limit privilege. setting("position", "self_protection_max_size_high", {x = 512, y = 512, z = 512}) setting("number", "self_protection_max_areas_high", 32) - --- configure the refresh delay for the name displays in the HUD -setting("number", "tick", 1)