aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-01-26 18:40:25 +0100
committerShadowNinja <shadowninja@minetest.net>2014-02-03 17:33:59 -0500
commit857a49e08131bb46ca18d08d3b4aba44df1676d1 (patch)
treec947fc1b82a122035d924ed21d890cd3bd8b18e0 /builtin
parentea0def381da04d3704a51b8a31a78ddd0737a06a (diff)
downloadminetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.tar.gz
minetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.tar.bz2
minetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.zip
Add minetest.kick_player(name, reason)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/chatcommands.lua22
-rw-r--r--builtin/privileges.lua1
2 files changed, 21 insertions, 2 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua
index b9661a888..66fcab63a 100644
--- a/builtin/chatcommands.lua
+++ b/builtin/chatcommands.lua
@@ -107,7 +107,7 @@ minetest.register_chatcommand("grant", {
description = "Give privilege to player",
privs = {},
func = function(name, param)
- if not minetest.check_player_privs(name, {privs=true}) and
+ if not minetest.check_player_privs(name, {privs=true}) and
not minetest.check_player_privs(name, {basic_privs=true}) then
minetest.chat_send_player(name, "Your privileges are insufficient.")
return
@@ -153,7 +153,7 @@ minetest.register_chatcommand("revoke", {
description = "Remove privilege from player",
privs = {},
func = function(name, param)
- if not minetest.check_player_privs(name, {privs=true}) and
+ if not minetest.check_player_privs(name, {privs=true}) and
not minetest.check_player_privs(name, {basic_privs=true}) then
minetest.chat_send_player(name, "Your privileges are insufficient.")
return
@@ -670,6 +670,24 @@ minetest.register_chatcommand("unban", {
end,
})
+minetest.register_chatcommand("kick", {
+ params = "<name> [reason]",
+ description = "kick a player",
+ privs = {kick=true},
+ func = function(name, param)
+ local tokick, reason = string.match(param, "([^ ]+) (.+)")
+ if not tokick then
+ tokick = param
+ end
+ if not minetest.kick_player(tokick, reason) then
+ minetest.chat_send_player(name, "Failed to kick player " .. tokick)
+ else
+ minetest.chat_send_player(name, "kicked " .. tokick)
+ minetest.log("action", name .. " kicked " .. tokick)
+ end
+ end,
+})
+
minetest.register_chatcommand("clearobjects", {
params = "",
description = "clear all objects in world",
diff --git a/builtin/privileges.lua b/builtin/privileges.lua
index 8dd06b24f..244aa453c 100644
--- a/builtin/privileges.lua
+++ b/builtin/privileges.lua
@@ -34,6 +34,7 @@ minetest.register_privilege("basic_privs", "Can modify 'shout' and 'interact' pr
minetest.register_privilege("server", "Can do server maintenance stuff")
minetest.register_privilege("shout", "Can speak in chat")
minetest.register_privilege("ban", "Can ban and unban players")
+minetest.register_privilege("kick", "Can kick players")
minetest.register_privilege("give", "Can use /give and /giveme")
minetest.register_privilege("password", "Can use /setpassword and /clearpassword")
minetest.register_privilege("fly", {