diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index fb38c1b35..21752ce7f 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -702,6 +702,7 @@ function core.privs_to_string(privs, delim) list[#list + 1] = priv end end + table.sort(list) return table.concat(list, delim) end diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index baab5212f..b7e2aea50 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -221,6 +221,7 @@ core.register_chatcommand("haspriv", { return true, S("No online player has the \"@1\" privilege.", param) else + table.sort(players_with_priv) return true, S("Players online with the \"@1\" privilege: @2", param, table.concat(players_with_priv, ", ")) diff --git a/src/server.cpp b/src/server.cpp index 0b0786209..1d98e4634 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3181,14 +3181,11 @@ std::string Server::getStatusString() bool first = true; os << " | clients: "; if (m_env) { - std::vector clients = m_clients.getClientIDs(); - for (session_t client_id : clients) { - RemotePlayer *player = m_env->getPlayer(client_id); + std::vector player_names = m_clients.getPlayerNames(); - // Get name of player - const std::string name = player ? player->getName() : ""; + std::sort(player_names.begin(), player_names.end()); - // Add name to information string + for (const std::string& name : player_names) { if (!first) os << ", "; else