diff --git a/chatcommands.lua b/chatcommands.lua index 07620d9..dec28e5 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -40,6 +40,9 @@ minetest.register_chatcommand("creative_region_privs", { if not found or not region_id or not privstring then return false, "Syntax error" end + if privstring == "nil" then + privstring = nil + end creative_regions.set_region_privs(tostring(region_id), privstring) minetest.chat_send_player(name, "[creative_regions] Privstring set for region " .. region_id .. ": " .. privstring) diff --git a/items.lua b/items.lua index 7465169..681efa8 100644 --- a/items.lua +++ b/items.lua @@ -106,15 +106,19 @@ if minetest.get_modpath("areas") then local name = digger:get_player_name() local current_areas = areas:getAreasAtPos(pos) + local num_removed = 0 for areas_id, areas_area in pairs( current_areas ) do local id = "a"..tostring(areas_id) if stored_id == id and privstring == creative_regions.region_privs[tostring(id)] then creative_regions.set_region_privs(id, nil) - minetest.chat_send_player(name, "[creative_regions] "..description.." removed for area " .. id) creative_regions.save_regions() + num_removed = num_removed + 1 + end + if num_removed == 1 then + minetest.chat_send_player(name, "[creative_regions] "..description.." removed for area " .. stored_id) else minetest.chat_send_player(name, "[creative_regions] Failed to remove privileges!") - minetest.log("warning", "[creative_regions] Failed to remove privileges for "..description.." at "..dump(pos)) + minetest.log("warning", "[creative_regions] Failed to remove privileges for "..description..", area id "..stored_id.." at "..dump(pos)) end end