Disable node inspection on use if it was enabled before the worldedit privilege was removed from a player to prevent spamming.

This commit is contained in:
khonkhortisan 2014-04-18 13:06:55 -07:00
parent 7083a26e72
commit 4475909a97
2 changed files with 7 additions and 5 deletions

View File

@ -107,6 +107,7 @@ minetest.register_on_punchnode(function(pos, node, puncher)
node.name, minetest.pos_to_string(pos), node.param1, node.param2, name, axis .. (sign > 0 and "+" or "-"))
else
message = "inspector: worldedit privileges required"
worldedit.inspect[name] = nil
end
worldedit.player_notify(name, message)
end

View File

@ -35,8 +35,9 @@ end
--this is... within chatcommands that actually change land
--(should be the same functions as safe_region)
--also check for permission when region is set?
worldedit.can_edit_volume = function(name, pos1, pos2)
--also check for permission when region is set? no, //stack goes outside the boundaries.
--so the region is defined per-command on exec.
worldedit.can_edit_volume = function(name, pos1, pos2) --, func?
--old you-can-worldedit-everything behaviour.
if not PROTECTION_MOD_EXISTS or minetest.check_player_privs(name, {areas=true}) then
--If there's no mod, worldedit.privs already required that you have the worldedit privilege,then if you were able to run this command, then you have the worldedit privilege.
@ -48,8 +49,8 @@ worldedit.can_edit_volume = function(name, pos1, pos2)
--[[I need to use a special per-command region (think /stack, or even worse, /move), the same one safe_region uses, but corner points instead of count... instead of a for loop interpolating between pos1 and pos2]]--
--all-or-nothing here
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
--pos1, pos2 = worldedit.sort_pos(pos1, pos2) --does this matter?
--local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
pos1, pos2 = worldedit.sort_pos(pos1, pos2) --does this matter?
for i in area:iterp(pos1, pos2) do
--[[
THIS SECTION IGNORES the distinction of area that is owned by someone else, but still editable
@ -81,6 +82,6 @@ worldedit.can_edit_volume = function(name, pos1, pos2)
--the whole thing is
--a) owned by me,
--b) owned by no one and I have the worldedit privilege, and/or
--c) owned by someone else and I have the areas privilege.
--c) I have the areas privilege and it's possibly owned by someone else.
return true
end