mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 02:00:37 +01:00
Updated xban2
This commit is contained in:
parent
0769feaf5a
commit
431c4bbc3c
@ -193,13 +193,10 @@ minetest.register_chatcommand("xban", {
|
|||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local plname, reason = params:match("(%S+)%s+(.+)")
|
local plname, reason = params:match("(%S+)%s+(.+)")
|
||||||
if not (plname and reason) then
|
if not (plname and reason) then
|
||||||
minetest.chat_send_player(name,
|
return false, "Usage: /xban <player> <reason>"
|
||||||
"Usage: /xban <player> <reason>")
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
xban.ban_player(plname, name, nil, reason)
|
xban.ban_player(plname, name, nil, reason)
|
||||||
minetest.chat_send_player(name,
|
return true, ("Banned %s."):format(plname)
|
||||||
("Banned %s."):format(plname))
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -210,21 +207,15 @@ minetest.register_chatcommand("xtempban", {
|
|||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local plname, time, reason = params:match("(%S+)%s+(%S+)%s+(.+)")
|
local plname, time, reason = params:match("(%S+)%s+(%S+)%s+(.+)")
|
||||||
if not (plname and time and reason) then
|
if not (plname and time and reason) then
|
||||||
minetest.chat_send_player(name,
|
return false, "Usage: /xtempban <player> <time> <reason>"
|
||||||
"Usage: /xtempban <player> <time> <reason>")
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
time = parse_time(time)
|
time = parse_time(time)
|
||||||
if time < 60 then
|
if time < 60 then
|
||||||
minetest.chat_send_player(name,
|
return false, "You must ban for at least 60 seconds."
|
||||||
"You must ban for at least 60 seconds.")
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
local expires = os.time() + time
|
local expires = os.time() + time
|
||||||
xban.ban_player(plname, name, expires, reason)
|
xban.ban_player(plname, name, expires, reason)
|
||||||
minetest.chat_send_player(name,
|
return true, ("Banned %s until %s."):format(plname, os.date("%c", expires))
|
||||||
("Banned %s until %s."):format(
|
|
||||||
plname, os.date("%c", expires)))
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -240,8 +231,7 @@ minetest.register_chatcommand("xunban", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ok, e = xban.unban_player(plname, name)
|
local ok, e = xban.unban_player(plname, name)
|
||||||
minetest.chat_send_player(name,
|
return ok, ok and ("Unbanned %s."):format(plname) or e
|
||||||
("Unbanned %s."):format(plname))
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -252,9 +242,7 @@ minetest.register_chatcommand("xban_record", {
|
|||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local plname = params:match("%S+")
|
local plname = params:match("%S+")
|
||||||
if not plname then
|
if not plname then
|
||||||
minetest.chat_send_player(name,
|
return false, "Usage: /xban_record <player_or_ip>"
|
||||||
"Usage: /xban_record <player_or_ip>")
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
local record, last_pos = xban.get_record(plname)
|
local record, last_pos = xban.get_record(plname)
|
||||||
if not record then
|
if not record then
|
||||||
@ -268,6 +256,7 @@ minetest.register_chatcommand("xban_record", {
|
|||||||
if last_pos then
|
if last_pos then
|
||||||
minetest.chat_send_player(name, "[xban] "..last_pos)
|
minetest.chat_send_player(name, "[xban] "..last_pos)
|
||||||
end
|
end
|
||||||
|
return true, "Record listed."
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user