mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Sort clients in minetest.get_server_status
and privs in minetest.privs_to_string
(#15023)
This commit is contained in:
parent
6cc0452503
commit
b2f6a65bc9
3 changed files with 5 additions and 6 deletions
|
@ -3181,14 +3181,11 @@ std::string Server::getStatusString()
|
|||
bool first = true;
|
||||
os << " | clients: ";
|
||||
if (m_env) {
|
||||
std::vector<session_t> clients = m_clients.getClientIDs();
|
||||
for (session_t client_id : clients) {
|
||||
RemotePlayer *player = m_env->getPlayer(client_id);
|
||||
std::vector<std::string> player_names = m_clients.getPlayerNames();
|
||||
|
||||
// Get name of player
|
||||
const std::string name = player ? player->getName() : "<unknown>";
|
||||
std::sort(player_names.begin(), player_names.end());
|
||||
|
||||
// Add name to information string
|
||||
for (const std::string& name : player_names) {
|
||||
if (!first)
|
||||
os << ", ";
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue