formspec protection added

This commit is contained in:
Joachim Stolberg 2019-01-28 07:18:38 +01:00
parent e91e2722d1
commit 1af6d380d3

@ -82,11 +82,14 @@ minetest.register_node("sl_controller:server", {
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if player:get_player_name() == owner then
if fields.names and fields.names ~= "" then if fields.names and fields.names ~= "" then
local names = string.gsub(fields.names, " +", " ") local names = string.gsub(fields.names, " +", " ")
meta:set_string("names", names) meta:set_string("names", names)
meta:set_string("formspec", formspec(meta)) meta:set_string("formspec", formspec(meta))
end end
end
end, end,
on_dig = function(pos, node, puncher, pointed_thing) on_dig = function(pos, node, puncher, pointed_thing)