mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Player data to Database (#5475)
* Player data to Database Add player data into databases (SQLite3 & PG only) PostgreSQL & SQLite: better POO Design for databases Add --migrate-players argument to server + deprecation warning * Remove players directory if empty
This commit is contained in:
parent
dda171d292
commit
29ab20c272
31 changed files with 1555 additions and 378 deletions
|
@ -334,6 +334,22 @@ int ModApiServer::l_kick_player(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int ModApiServer::l_remove_player(lua_State *L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
std::string name = luaL_checkstring(L, 1);
|
||||
ServerEnvironment *s_env = dynamic_cast<ServerEnvironment *>(getEnv(L));
|
||||
assert(s_env);
|
||||
|
||||
RemotePlayer *player = s_env->getPlayer(name.c_str());
|
||||
if (!player)
|
||||
lua_pushinteger(L, s_env->removePlayerFromDatabase(name) ? 0 : 1);
|
||||
else
|
||||
lua_pushinteger(L, 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// unban_player_or_ip()
|
||||
int ModApiServer::l_unban_player_or_ip(lua_State *L)
|
||||
{
|
||||
|
@ -510,6 +526,7 @@ void ModApiServer::Initialize(lua_State *L, int top)
|
|||
API_FCT(get_ban_description);
|
||||
API_FCT(ban_player);
|
||||
API_FCT(kick_player);
|
||||
API_FCT(remove_player);
|
||||
API_FCT(unban_player_or_ip);
|
||||
API_FCT(notify_authentication_modified);
|
||||
|
||||
|
|
|
@ -92,6 +92,9 @@ private:
|
|||
// kick_player(name, [message]) -> success
|
||||
static int l_kick_player(lua_State *L);
|
||||
|
||||
// remove_player(name)
|
||||
static int l_remove_player(lua_State *L);
|
||||
|
||||
// notify_authentication_modified(name)
|
||||
static int l_notify_authentication_modified(lua_State *L);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue