Check protection of the forcefield and Quarry (#468)

This commit is contained in:
Lejo 2019-04-13 20:45:49 +02:00 committed by SmallJoker
parent c9ba4b329d
commit b81d1d3f2d
2 changed files with 12 additions and 0 deletions

View File

@ -121,6 +121,12 @@ local function set_forcefield_formspec(meta)
end
local forcefield_receive_fields = function(pos, formname, fields, sender)
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.chat_send_player(player_name, "You are not allowed to edit this!")
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
local range = nil
if fields.range then

View File

@ -60,6 +60,12 @@ local function set_quarry_demand(meta)
end
local function quarry_receive_fields(pos, formname, fields, sender)
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.chat_send_player(player_name, "You are not allowed to edit this!")
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if fields.size and string.find(fields.size, "^[0-9]+$") then
local size = tonumber(fields.size)