diff options
author | sapier <Sapier at GMX dot net> | 2014-01-26 18:40:25 +0100 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-02-03 17:33:59 -0500 |
commit | 857a49e08131bb46ca18d08d3b4aba44df1676d1 (patch) | |
tree | c947fc1b82a122035d924ed21d890cd3bd8b18e0 /builtin/chatcommands.lua | |
parent | ea0def381da04d3704a51b8a31a78ddd0737a06a (diff) | |
download | minetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.tar.gz minetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.tar.bz2 minetest-857a49e08131bb46ca18d08d3b4aba44df1676d1.zip |
Add minetest.kick_player(name, reason)
Diffstat (limited to 'builtin/chatcommands.lua')
-rw-r--r-- | builtin/chatcommands.lua | 22 |
1 files changed, 20 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", |