diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-06-11 13:43:12 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-11 13:43:12 +0200 |
commit | 409d04324f0a81eaa78ff9161b4f3593d89151c5 (patch) | |
tree | cdd5f688a639ce3eb34dde450173989907e52c94 /builtin/game | |
parent | fb4e4f048ea8c53d20465ee17fddbfc0ae946b74 (diff) | |
download | minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.tar.gz minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.tar.bz2 minetest-409d04324f0a81eaa78ff9161b4f3593d89151c5.zip |
Fix the /shutdown command (#7431)
Diffstat (limited to 'builtin/game')
-rw-r--r-- | builtin/game/chatcommands.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 3b701c1fd..31ce4359f 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -827,13 +827,15 @@ core.register_chatcommand("shutdown", { description = "Shutdown server (-1 cancels a delayed shutdown)", privs = {server=true}, func = function(name, param) - local delay, reconnect, message = param:match("([^ ][-]?[0-9]+)([^ ]+)(.*)") - message = message or "" + local delay, reconnect, message + delay, param = param:match("^%s*(%S+)(.*)") + if param then + reconnect, param = param:match("^%s*(%S+)(.*)") + end + message = param and param:match("^%s*(.+)") or "" + delay = tonumber(delay) or 0 - if delay ~= "" then - delay = tonumber(delay) or 0 - else - delay = 0 + if delay == 0 then core.log("action", name .. " shuts down server") core.chat_send_all("*** Server shutting down (operator request).") end |