Don't allow /granting unknown privileges
parent
67547f74fc
commit
b54178bbbd
|
@ -99,9 +99,17 @@ minetest.register_chatcommand("grant", {
|
||||||
grantprivs = minetest.registered_privileges
|
grantprivs = minetest.registered_privileges
|
||||||
end
|
end
|
||||||
local privs = minetest.get_player_privs(grantname)
|
local privs = minetest.get_player_privs(grantname)
|
||||||
|
local privs_known = true
|
||||||
for priv, _ in pairs(grantprivs) do
|
for priv, _ in pairs(grantprivs) do
|
||||||
|
if not minetest.registered_privileges[priv] then
|
||||||
|
minetest.chat_send_player(name, "Unknown privilege: "..priv)
|
||||||
|
privs_known = false
|
||||||
|
end
|
||||||
privs[priv] = true
|
privs[priv] = true
|
||||||
end
|
end
|
||||||
|
if not privs_known then
|
||||||
|
return
|
||||||
|
end
|
||||||
minetest.set_player_privs(grantname, privs)
|
minetest.set_player_privs(grantname, privs)
|
||||||
minetest.chat_send_player(name, "Privileges of "..grantname..": "..minetest.privs_to_string(minetest.get_player_privs(grantname), ' '))
|
minetest.chat_send_player(name, "Privileges of "..grantname..": "..minetest.privs_to_string(minetest.get_player_privs(grantname), ' '))
|
||||||
if grantname ~= name then
|
if grantname ~= name then
|
||||||
|
|
Loading…
Reference in New Issue