Don't allow /granting unknown privileges

This commit is contained in:
Perttu Ahola 2012-04-01 12:45:38 +03:00 committed by Nils Dagsson Moskopp
parent 397bd5fc83
commit aefc412901
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 8 additions and 0 deletions

View File

@ -99,9 +99,17 @@ minetest.register_chatcommand("grant", {
grantprivs = minetest.registered_privileges
end
local privs = minetest.get_player_privs(grantname)
local privs_known = true
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
end
if not privs_known then
return
end
minetest.set_player_privs(grantname, privs)
minetest.chat_send_player(name, "Privileges of "..grantname..": "..minetest.privs_to_string(minetest.get_player_privs(grantname), ' '))
if grantname ~= name then