From 0d86f2c45eee3382e59652fce678d9c39a677d77 Mon Sep 17 00:00:00 2001 From: auouymous <5005204+auouymous@users.noreply.github.com> Date: Thu, 12 Nov 2020 11:26:02 -0700 Subject: [PATCH] Prevent unauthorized players from changing the noteblock sound. (#547) --- mesecons_noteblock/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index d29ab88..577cee0 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -3,7 +3,11 @@ minetest.register_node("mesecons_noteblock:noteblock", { tiles = {"mesecons_noteblock.png"}, is_ground_content = false, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, - on_punch = function(pos, node) -- change sound when punched + on_punch = function(pos, node, puncher) -- change sound when punched + if minetest.is_protected(pos, puncher and puncher:get_player_name()) then + return + end + node.param2 = (node.param2+1)%12 mesecon.noteblock_play(pos, node.param2) minetest.set_node(pos, node)