aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-07-17 06:30:21 +0200
committerest31 <MTest31@outlook.com>2015-07-17 06:37:16 +0200
commitbf7174f3f98f0ac665e093aaa3e332f8bd29b64b (patch)
tree800a92674f526bae4073e3ceeef3896363c2bacf /src
parentf9dbec6edf94ce20d52d38569545674cfb742eae (diff)
downloadminetest-bf7174f3f98f0ac665e093aaa3e332f8bd29b64b.tar.gz
minetest-bf7174f3f98f0ac665e093aaa3e332f8bd29b64b.tar.bz2
minetest-bf7174f3f98f0ac665e093aaa3e332f8bd29b64b.zip
Server kicks: make messages configurable, cache wstring
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp3
-rw-r--r--src/environment.cpp3
-rw-r--r--src/server.cpp6
3 files changed, 8 insertions, 4 deletions
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;