summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-23 16:09:44 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-23 16:09:44 +0200
commitbbc0fb55c69a7234aff93e4155053c32c9c06342 (patch)
treec9618918350951dbf783bf9b660ee6f633a93d19
parent3c0d10714bc2c01a145515849e2358871491b24a (diff)
Added option to add notes to criminal record, map ip to time
The option to map IP address to time will make it easier to delete personal information after a certain time, since the IP records can be expired after a certain time if the player has commited no large infractions. Also, this would prevent players with dynamic IP addresses from being accidentally banned because of a previous owner.
-rw-r--r--init.lua27
1 files changed, 25 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 24dab44..0f816d2 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
@@ -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>",