1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Make /status message easier to read

This commit is contained in:
Wuzzy 2021-03-17 19:03:00 +01:00 committed by sfan5
parent 02292e03e4
commit fe7195badb
2 changed files with 31 additions and 10 deletions

View file

@ -3119,15 +3119,16 @@ std::string Server::getStatusString()
std::ostringstream os(std::ios_base::binary);
os << "# Server: ";
// Version
os << "version=" << g_version_string;
os << "version: " << g_version_string;
// Uptime
os << ", uptime=" << m_uptime_counter->get();
os << " | uptime: " << duration_to_string((int) m_uptime_counter->get());
// Max lag estimate
os << ", max_lag=" << (m_env ? m_env->getMaxLagEstimate() : 0);
os << " | max lag: " << std::setprecision(3);
os << (m_env ? m_env->getMaxLagEstimate() : 0) << "s";
// Information about clients
bool first = true;
os << ", clients={";
os << " | clients: ";
if (m_env) {
std::vector<session_t> clients = m_clients.getClientIDs();
for (session_t client_id : clients) {
@ -3144,7 +3145,6 @@ std::string Server::getStatusString()
os << name;
}
}
os << "}";
if (m_env && !((ServerMap*)(&m_env->getMap()))->isSavingEnabled())
os << std::endl << "# Server: " << " WARNING: Map saving is disabled.";