diff options
author | cheapie <no-email-for-you@example.com> | 2017-02-04 22:21:37 +0100 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2017-02-04 15:21:37 -0600 |
commit | 02ea436a939071ce3cfd2b18f0b55d886aa5aa0a (patch) | |
tree | 2206751b43c12af9fac158e51e0e8df1614f0007 | |
parent | b98d60a1512d068d6751d9824216ccada94697ce (diff) | |
download | rgblightstone-02ea436a939071ce3cfd2b18f0b55d886aa5aa0a.tar rgblightstone-02ea436a939071ce3cfd2b18f0b55d886aa5aa0a.tar.gz rgblightstone-02ea436a939071ce3cfd2b18f0b55d886aa5aa0a.tar.bz2 rgblightstone-02ea436a939071ce3cfd2b18f0b55d886aa5aa0a.tar.xz rgblightstone-02ea436a939071ce3cfd2b18f0b55d886aa5aa0a.zip |
Add protection support (#3)
-rw-r--r-- | init.lua | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -8,7 +8,12 @@ else end end -function rgblightstone.autofill(pos,player) +function rgblightstone.autofill(pos, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, { protection_bypass = true }) then + minetest.record_protection_violation(pos, name) + return + end local meta = minetest.get_meta(pos) if (not meta:get_string("channel")) or meta:get_string("channel")=="" then local pos_above = {x=pos.x,y=pos.y+1,z=pos.z} @@ -48,6 +53,11 @@ minetest.register_node("rgblightstone:rgblightstone", { rgblightstone.autofill(pos,player) end, on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, { protection_bypass = true }) then + minetest.record_protection_violation(pos, name) + return + end local meta = minetest.get_meta(pos) if fields.autofill then rgblightstone.autofill(pos,sender) |