mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Kick players when shutting down server and there is a crash due to a Lua stack exception
This commit is contained in:
@@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "mapblock_mesh.h"
|
||||
#include "event.h"
|
||||
#endif
|
||||
#include "server.h"
|
||||
#include "daynightratio.h"
|
||||
#include "map.h"
|
||||
#include "emerge.h"
|
||||
@@ -425,6 +426,15 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize, v3s16
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerEnvironment::kickAllPlayers(const std::string &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));
|
||||
}
|
||||
}
|
||||
|
||||
void ServerEnvironment::saveLoadedPlayers()
|
||||
{
|
||||
std::string players_path = m_path_world + DIR_DELIM "players";
|
||||
|
Reference in New Issue
Block a user