mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Fix the /shutdown command (#7431)
This commit is contained in:
parent
fb4e4f048e
commit
409d04324f
2 changed files with 15 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue