aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCorey Powell <mistdragon100@gmail.com>2021-11-26 14:19:40 -0500
committerGitHub <noreply@github.com>2021-11-26 19:19:40 +0000
commit413be76c63309266d3d271f01cc74385067d7263 (patch)
tree1af31eb460950e937979e0036b679c600e12b887 /src
parentc85aa0030f48e088d64a60b1e0df924a68c3964a (diff)
downloadminetest-413be76c63309266d3d271f01cc74385067d7263.tar.gz
minetest-413be76c63309266d3d271f01cc74385067d7263.tar.bz2
minetest-413be76c63309266d3d271f01cc74385067d7263.zip
Implemented disconnect_player (#10492)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_server.cpp12
-rw-r--r--src/script/lua_api/l_server.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 476f74c9c..82a692070 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -310,8 +310,8 @@ int ModApiServer::l_ban_player(lua_State *L)
return 1;
}
-// kick_player(name, [reason]) -> success
-int ModApiServer::l_kick_player(lua_State *L)
+// disconnect_player(name, [reason]) -> success
+int ModApiServer::l_disconnect_player(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
@@ -319,11 +319,11 @@ int ModApiServer::l_kick_player(lua_State *L)
throw LuaError("Can't kick player before server has started up");
const char *name = luaL_checkstring(L, 1);
- std::string message("Kicked");
+ std::string message;
if (lua_isstring(L, 2))
- message.append(": ").append(readParam<std::string>(L, 2));
+ message.append(readParam<std::string>(L, 2));
else
- message.append(".");
+ message.append("Disconnected.");
RemotePlayer *player = dynamic_cast<ServerEnvironment *>(getEnv(L))->getPlayer(name);
if (player == NULL) {
@@ -554,7 +554,7 @@ void ModApiServer::Initialize(lua_State *L, int top)
API_FCT(get_ban_list);
API_FCT(get_ban_description);
API_FCT(ban_player);
- API_FCT(kick_player);
+ API_FCT(disconnect_player);
API_FCT(remove_player);
API_FCT(unban_player_or_ip);
API_FCT(notify_authentication_modified);
diff --git a/src/script/lua_api/l_server.h b/src/script/lua_api/l_server.h
index a6f709787..f05c0b7c9 100644
--- a/src/script/lua_api/l_server.h
+++ b/src/script/lua_api/l_server.h
@@ -97,8 +97,8 @@ private:
// unban_player_or_ip()
static int l_unban_player_or_ip(lua_State *L);
- // kick_player(name, [message]) -> success
- static int l_kick_player(lua_State *L);
+ // disconnect_player(name, [reason]) -> success
+ static int l_disconnect_player(lua_State *L);
// remove_player(name)
static int l_remove_player(lua_State *L);