summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2021-06-12 16:48:21 +0000
committerGitHub <noreply@github.com>2021-06-12 18:48:21 +0200
commitdc165fe942bcc48d7dea0a7b722886937d9c6914 (patch)
treea54627502407381b9cbbbf6f3146584205fc44d5 /builtin
parentfbcf0fab8e955b819d3d77b7578f39ce24eec71b (diff)
downloadminetest-dc165fe942bcc48d7dea0a7b722886937d9c6914.tar.gz
minetest-dc165fe942bcc48d7dea0a7b722886937d9c6914.tar.bz2
minetest-dc165fe942bcc48d7dea0a7b722886937d9c6914.zip
Message for empty list output in /haspriv & /mods (#11149)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/chat.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua
index e155fba70..354b0ff90 100644
--- a/builtin/game/chat.lua
+++ b/builtin/game/chat.lua
@@ -212,9 +212,14 @@ core.register_chatcommand("haspriv", {
table.insert(players_with_priv, player_name)
end
end
- return true, S("Players online with the \"@1\" privilege: @2",
- param,
- table.concat(players_with_priv, ", "))
+ if #players_with_priv == 0 then
+ return true, S("No online player has the \"@1\" privilege.",
+ param)
+ else
+ return true, S("Players online with the \"@1\" privilege: @2",
+ param,
+ table.concat(players_with_priv, ", "))
+ end
end
})
@@ -737,7 +742,12 @@ core.register_chatcommand("mods", {
description = S("List mods installed on the server"),
privs = {},
func = function(name, param)
- return true, table.concat(core.get_modnames(), ", ")
+ local mods = core.get_modnames()
+ if #mods == 0 then
+ return true, S("No mods installed.")
+ else
+ return true, table.concat(core.get_modnames(), ", ")
+ end
end,
})