Skip to content

Commit fc1512c

Browse files
authoredMar 26, 2021
Translate chatcommand delay message and replace minetest with core (#11113)
1 parent 6a26d6d commit fc1512c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎builtin/game/chat.lua

+7-6
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ core.register_on_chat_message(function(name, message)
7575
local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs)
7676
if has_privs then
7777
core.set_last_run_mod(cmd_def.mod_origin)
78-
local t_before = minetest.get_us_time()
78+
local t_before = core.get_us_time()
7979
local success, result = cmd_def.func(name, param)
80-
local delay = (minetest.get_us_time() - t_before) / 1000000
80+
local delay = (core.get_us_time() - t_before) / 1000000
8181
if success == false and result == nil then
8282
core.chat_send_player(name, "-!- "..S("Invalid command usage."))
8383
local help_def = core.registered_chatcommands["help"]
@@ -91,11 +91,12 @@ core.register_on_chat_message(function(name, message)
9191
if delay > msg_time_threshold then
9292
-- Show how much time it took to execute the command
9393
if result then
94-
result = result ..
95-
minetest.colorize("#f3d2ff", " (%.5g s)"):format(delay)
94+
result = result .. core.colorize("#f3d2ff", S(" (@1 s)",
95+
string.format("%.5f", delay)))
9696
else
97-
result = minetest.colorize("#f3d2ff",
98-
"Command execution took %.5f s"):format(delay)
97+
result = core.colorize("#f3d2ff", S(
98+
"Command execution took @1 s",
99+
string.format("%.5f", delay)))
99100
end
100101
end
101102
if result then

0 commit comments

Comments
 (0)