aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@linux-forks.de>2018-09-24 01:46:36 +0200
committerroot <root@linux-forks.de>2018-09-24 01:46:36 +0200
commit80b62f749585eb3ab36f35f7f42b6dee4112697c (patch)
tree43a74ba03d8d1c4b27eaedac991d1508f34f964f
parent027897390b8286226f60b937b0481bd75bd67f9f (diff)
parent563e0a7bca093aae8ddc0e1af73083b406b809f1 (diff)
downloadxban2-80b62f749585eb3ab36f35f7f42b6dee4112697c.tar.gz
xban2-80b62f749585eb3ab36f35f7f42b6dee4112697c.tar.bz2
xban2-80b62f749585eb3ab36f35f7f42b6dee4112697c.zip
Merge https://git.bananach.space/xban2
-rw-r--r--init.lua29
1 files changed, 26 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 24dab44..4e1a997 100644
--- a/init.lua
+++ b/init.lua
@@ -107,7 +107,7 @@ function xban.ban_player(player, source, expires, reason) --> bool, err
if pl then
local ip = minetest.get_player_ip(player)
if ip then
- e.names[ip] = true
+ e.names[ip] = os.time()
end
e.last_pos = pl:getpos()
end
@@ -193,7 +193,7 @@ function xban.get_record(player)
if rec.source then
msg = msg..", Source: "..rec.source
end
- table.insert(record, ("[%s]: %s"):format(os.date("%c", e.time), msg))
+ table.insert(record, ("[%s]: %s"):format(os.date("%Y-%m-%d %H:%M:%S", rec.time), msg))
end
local last_pos
if e.last_pos then
@@ -229,7 +229,7 @@ minetest.register_on_joinplayer(function(player)
end
e.names[name] = true
if ip then
- e.names[ip] = true
+ e.names[ip] = os.time()
end
e.last_seen = os.time()
end)
@@ -268,6 +268,29 @@ minetest.register_chatcommand("xtempban", {
end,
})
+minetest.register_chatcommand("xnote", {
+ description = "Add a note to a player's criminal record",
+ params = "<player> <note>",
+ privs = { kick=true },
+ func = function(name, params)
+ local plname, note = params:match("(%S+)%s+(.+)")
+ if not (plname and note) then
+ return false, "Usage: /xnote <player> <note>"
+ end
+ local record = {
+ source = name,
+ time = os.time(),
+ expires = nil,
+ reason = note,
+ type = "note",
+ }
+ xban.add_record(plname, record)
+ return true, ("Added note for %s."):format(plname)
+ end,
+})
+
+
+
minetest.register_chatcommand("xunban", {
description = "XUnBan a player",
params = "<player_or_ip> <reason>",