From fe12b598ff3e31b88007f7f9bc4dec6a3ef4973e Mon Sep 17 00:00:00 2001 From: tigercoding56 <90169211+tigercoding56@users.noreply.github.com> Date: Sun, 23 Oct 2022 15:45:47 +0000 Subject: [PATCH] Update init.lua this commit adds a max - ban time which basically unbans banned players after 1 year (configurable) i recommend it set to between 1 to 10 years --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 09385bd..664d4e9 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,7 @@ local db = { } local tempbans = { } local DEF_SAVE_INTERVAL = 300 -- 5 minutes +local MAX_BAN_TIME = 31104000 -- 1 year but can be savely changed to higher or lower local DEF_DB_FILENAME = minetest.get_worldpath().."/xban.db" local DB_FILENAME = minetest.settings:get("xban.db_filename") @@ -358,6 +359,7 @@ local function save_db() end local function load_db() + local now = os.time() local f, e = io.open(DB_FILENAME, "rt") if not f then WARNING("Unable to load database: %s", e) @@ -379,6 +381,10 @@ local function load_db() for _, entry in ipairs(db) do if entry.banned and entry.expires then table.insert(tempbans, entry) + else + local wwe = entry + wwe.expires = now + MAX_BAN_TIME + table.insert(tempbans, ) end end end