-- Extended Ban Mod for Minetest -- (C) 2013 Diego Martínez -- See `LICENSE.txt' for details. -- chat.lua: Chat commands. minetest.register_chatcommand("ban", { params = " [reason]", description = "Ban all IPs for a given player", privs = { ban=true, }, func = function(name, param) param = param:trim() local player_name, reason = param:match("([^ ]+)( *.*)") if not player_name then xban._.send(name, "Usage: /ban [reason]") return end reason = reason:trim() xban._.ACTION("%s bans %s. Reason: %s", name, player_name, reason) if reason == "" then reason = nil end local r, e = xban.ban_player(player_name, nil, reason) if r then xban._.send(name, "Banning %s.", player_name) else xban._.send(name, "ERROR: %s.", e) end end, }) local mul = { [""]=1, s=1, m=60, h=3600, H=3600, d=3600*24, D=86400, w=86400*7, W=86400*7, M=86400*30 } local function parse_time(t) local total = 0 for count, suffix in t:gmatch("(%d+)([mhHdDwWM]?)") do count = count and tonumber(count) if count and suffix then total = (total or 0) + (count * mul[suffix]) end end if total then return total end end minetest.register_chatcommand("tempban", { params = "