forked from Mirrorlandia_minetest/minetest
Fix /help privs checks (#13008)
This commit is contained in:
parent
aac1635bf7
commit
da4a4086cf
@ -22,6 +22,7 @@ local LIST_FORMSPEC_DESCRIPTION = [[
|
|||||||
|
|
||||||
local F = core.formspec_escape
|
local F = core.formspec_escape
|
||||||
local S = core.get_translator("__builtin")
|
local S = core.get_translator("__builtin")
|
||||||
|
local check_player_privs = core.check_player_privs
|
||||||
|
|
||||||
|
|
||||||
-- CHAT COMMANDS FORMSPEC
|
-- CHAT COMMANDS FORMSPEC
|
||||||
@ -57,11 +58,10 @@ local function build_chatcommands_formspec(name, sel, copy)
|
|||||||
.. "any entry in the list.").. "\n" ..
|
.. "any entry in the list.").. "\n" ..
|
||||||
S("Double-click to copy the entry to the chat history.")
|
S("Double-click to copy the entry to the chat history.")
|
||||||
|
|
||||||
local privs = core.get_player_privs(name)
|
|
||||||
for i, data in ipairs(mod_cmds) do
|
for i, data in ipairs(mod_cmds) do
|
||||||
rows[#rows + 1] = COLOR_BLUE .. ",0," .. F(data[1]) .. ","
|
rows[#rows + 1] = COLOR_BLUE .. ",0," .. F(data[1]) .. ","
|
||||||
for j, cmds in ipairs(data[2]) do
|
for j, cmds in ipairs(data[2]) do
|
||||||
local has_priv = privs[cmds[2].privs]
|
local has_priv = check_player_privs(name, cmds[2].privs)
|
||||||
rows[#rows + 1] = ("%s,1,%s,%s"):format(
|
rows[#rows + 1] = ("%s,1,%s,%s"):format(
|
||||||
has_priv and COLOR_GREEN or COLOR_GRAY,
|
has_priv and COLOR_GREEN or COLOR_GRAY,
|
||||||
cmds[1], F(cmds[2].params))
|
cmds[1], F(cmds[2].params))
|
||||||
|
Loading…
Reference in New Issue
Block a user