1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Optional reconnect functionality

Enable the server to request the client to reconnect.

This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
This commit is contained in:
est31 2015-07-17 16:40:41 +02:00
parent 1e0e85f82e
commit 3b50b2766a
25 changed files with 232 additions and 109 deletions

View file

@ -426,13 +426,15 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize, v3s16
return true;
}
void ServerEnvironment::kickAllPlayers(const std::string &reason)
void ServerEnvironment::kickAllPlayers(AccessDeniedCode reason,
const std::string &str_reason, bool reconnect)
{
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, wreason);
((Server*)m_gamedef)->DenyAccessVerCompliant((*it)->peer_id,
(*it)->protocol_version, (AccessDeniedCode)reason,
str_reason, reconnect);
}
}