Check if player exists on use of /privs (#7554)
authorClobberXD <ClobberXD@gmail.com>
Mon, 16 Jul 2018 12:55:04 +0000 (18:25 +0530)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 16 Jul 2018 12:55:03 +0000 (14:55 +0200)
* /privs: Check if player exists

builtin/game/chatcommands.lua

index 4aef063de11b4de466bb7b378ffb82eef6a6a051..98567057260414862f11ccaba4bbb7a7204ac77a 100644 (file)
@@ -84,7 +84,7 @@ core.register_chatcommand("admin", {
        func = function(name)
                local admin = core.settings:get("name")
                if admin then
-                       return true, "The administrator of this server is "..admin.."."
+                       return true, "The administrator of this server is " .. admin .. "."
                else
                        return false, "There's no administrator named in the config file."
                end
@@ -97,6 +97,9 @@ core.register_chatcommand("privs", {
        func = function(caller, param)
                param = param:trim()
                local name = (param ~= "" and param or caller)
+               if not core.player_exists(name) then
+                       return false, "Player " .. name .. " does not exist."
+               end
                return true, "Privileges of " .. name .. ": "
                        .. core.privs_to_string(
                                core.get_player_privs(name), ' ')