aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--minetest.conf.example6
-rw-r--r--src/defaultsettings.cpp3
-rw-r--r--src/environment.cpp3
-rw-r--r--src/server.cpp6
4 files changed, 14 insertions, 4 deletions
diff --git a/minetest.conf.example b/minetest.conf.example
index aef82c3ad..7029f591e 100644
--- a/minetest.conf.example
+++ b/minetest.conf.example
@@ -388,6 +388,12 @@
# "log" = mimic and log backtrace of deprecated call (default for debug).
# "error" = abort on usage of deprecated call (suggested for mod developers).
#deprecated_lua_api_handling = legacy
+
+#kick_msg_shutdown = Server shutting down.
+# A message to be displayed to all clients when the server shuts down
+#kick_msg_crash = This server has experienced an internal error. You will now be disconnected.
+# A message to be displayed to all clients when the server crashes
+
# Mod profiler
#mod_profiling = false
# Detailed mod profile data
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index da5dcae94..8df0fbbd8 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -252,6 +252,9 @@ void set_default_settings(Settings *settings)
settings->setDefault("deprecated_lua_api_handling", "log");
#endif
+ settings->setDefault("kick_msg_shutdown", "Server shutting down.");
+ settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
+
settings->setDefault("profiler_print_interval", "0");
settings->setDefault("enable_mapgen_debug_info", "false");
settings->setDefault("active_object_send_range_blocks", "3");
diff --git a/src/environment.cpp b/src/environment.cpp
index cad1f298b..d22982b68 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -428,10 +428,11 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize, v3s16
void ServerEnvironment::kickAllPlayers(const std::string &reason)
{
+ std::wstring wreason = utf8_to_wide(reason);
for (std::vector<Player*>::iterator it = m_players.begin();
it != m_players.end();
++it) {
- ((Server*)m_gamedef)->DenyAccess_Legacy((*it)->peer_id, utf8_to_wide(reason));
+ ((Server*)m_gamedef)->DenyAccess_Legacy((*it)->peer_id, wreason);
}
}
diff --git a/src/server.cpp b/src/server.cpp
index 0cad82613..2d6de1c9d 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -397,8 +397,8 @@ Server::~Server()
infostream << "Server: Saving players" << std::endl;
m_env->saveLoadedPlayers();
- infostream << "Server: kick players" << std::endl;
- m_env->kickAllPlayers("Server shutting down...");
+ infostream << "Server: Kicking players" << std::endl;
+ m_env->kickAllPlayers(g_settings->get("kick_msg_shutdown"));
infostream << "Server: Saving environment metadata" << std::endl;
m_env->saveMeta();
@@ -502,7 +502,7 @@ void Server::step(float dtime)
throw ServerError(async_err);
}
else {
- m_env->kickAllPlayers("The server has crashed. Disconnecting all players. Please reconnect soon...");
+ m_env->kickAllPlayers(g_settings->get("kick_msg_crash"));
errorstream << "UNRECOVERABLE error occurred. Stopping server. "
<< "Please fix the following error:" << std::endl
<< async_err << std::endl;