diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-04-01 12:45:38 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-04-01 12:45:38 +0300 |
commit | b54178bbbdf7e66ef5107fe3d0fe434b60cd9a68 (patch) | |
tree | 1b25e924d4ddcb8c60082517892d0dd8762566db /builtin | |
parent | 67547f74fc6176b978548a93c3c98b29d9cb0a22 (diff) | |
download | minetest-b54178bbbdf7e66ef5107fe3d0fe434b60cd9a68.tar.gz minetest-b54178bbbdf7e66ef5107fe3d0fe434b60cd9a68.tar.bz2 minetest-b54178bbbdf7e66ef5107fe3d0fe434b60cd9a68.zip |
Don't allow /granting unknown privileges
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/chatcommands.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua index d5f448ebb..570c07b05 100644 --- a/builtin/chatcommands.lua +++ b/builtin/chatcommands.lua @@ -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 |