aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_server.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-04-27 19:55:13 +0200
committersfan5 <sfan5@live.de>2022-04-28 20:05:26 +0200
commita65f6f07f3a5601207b790edcc8cc945133112f7 (patch)
tree976d7cfa2b8c9a693bdd3f6b0e579b84590d41d8 /src/script/lua_api/l_server.cpp
parent00f71c3b9d35e1cdd5aa62491a46068358aa8b2a (diff)
downloadminetest-a65f6f07f3a5601207b790edcc8cc945133112f7.tar.gz
minetest-a65f6f07f3a5601207b790edcc8cc945133112f7.tar.bz2
minetest-a65f6f07f3a5601207b790edcc8cc945133112f7.zip
Clean up some auth packet handling related code
Diffstat (limited to 'src/script/lua_api/l_server.cpp')
-rw-r--r--src/script/lua_api/l_server.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 88ab5e16b..5b3054d17 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -325,12 +325,15 @@ int ModApiServer::l_disconnect_player(lua_State *L)
else
message.append("Disconnected.");
- RemotePlayer *player = dynamic_cast<ServerEnvironment *>(getEnv(L))->getPlayer(name);
- if (player == NULL) {
+ Server *server = getServer(L);
+
+ RemotePlayer *player = server->getEnv().getPlayer(name);
+ if (!player) {
lua_pushboolean(L, false); // No such player
return 1;
}
- getServer(L)->DenyAccess_Legacy(player->getPeerId(), utf8_to_wide(message));
+
+ server->DenyAccess(player->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING, message);
lua_pushboolean(L, true);
return 1;
}