aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/misc.lua
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 /builtin/game/misc.lua
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 'builtin/game/misc.lua')
-rw-r--r--builtin/game/misc.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index 05237662c..ef826eda7 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -6,6 +6,16 @@ local S = core.get_translator("__builtin")
-- Misc. API functions
--
+-- @spec core.kick_player(String, String) :: Boolean
+function core.kick_player(player_name, reason)
+ if type(reason) == "string" then
+ reason = "Kicked: " .. reason
+ else
+ reason = "Kicked."
+ end
+ return core.disconnect_player(player_name, reason)
+end
+
function core.check_player_privs(name, ...)
if core.is_player(name) then
name = name:get_player_name()