From 1ea2b09ecb5dd2084d6767c0ea4d4fb112e6c6ba Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 10 Mar 2020 05:13:32 +0100 Subject: [PATCH] Commandblock: Fix help btn not working if no priv --- mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua index c55e0e416e..52210c4c41 100644 --- a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua @@ -266,19 +266,20 @@ minetest.register_node("mesecons_commandblock:commandblock_on", { minetest.register_on_player_receive_fields(function(player, formname, fields) if string.sub(formname, 1, 13) == "commandblock_" then - if (not fields.submit and not fields.key_enter and not fields.doc) or (not fields.commands) then + if fields.doc and minetest.get_modpath("doc") then + doc.show_entry(player:get_player_name(), "nodes", "mesecons_commandblock:commandblock_off", true) return end + if (not fields.submit and not fields.key_enter) or (not fields.commands) then + return + end + local privs = minetest.get_player_privs(player:get_player_name()) if not privs.maphack then minetest.chat_send_player(player:get_player_name(), S("Access denied. You need the “maphack” privilege to edit command blocks.")) return end - if fields.doc and minetest.get_modpath("doc") then - doc.show_entry(player:get_player_name(), "nodes", "mesecons_commandblock:commandblock_off", true) - return - end local index, _, x, y, z = string.find(formname, "commandblock_(-?%d+)_(-?%d+)_(-?%d+)") if index ~= nil and x ~= nil and y ~= nil and z ~= nil then local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}