mirror of
https://github.com/minetest-mods/xban2.git
synced 2025-04-30 13:41:40 -04:00
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
This commit is contained in:
parent
d2cda4f73a
commit
fe12b598ff
1 changed files with 6 additions and 0 deletions
6
init.lua
6
init.lua
|
@ -7,6 +7,7 @@ local db = { }
|
||||||
local tempbans = { }
|
local tempbans = { }
|
||||||
|
|
||||||
local DEF_SAVE_INTERVAL = 300 -- 5 minutes
|
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 DEF_DB_FILENAME = minetest.get_worldpath().."/xban.db"
|
||||||
|
|
||||||
local DB_FILENAME = minetest.settings:get("xban.db_filename")
|
local DB_FILENAME = minetest.settings:get("xban.db_filename")
|
||||||
|
@ -358,6 +359,7 @@ local function save_db()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function load_db()
|
local function load_db()
|
||||||
|
local now = os.time()
|
||||||
local f, e = io.open(DB_FILENAME, "rt")
|
local f, e = io.open(DB_FILENAME, "rt")
|
||||||
if not f then
|
if not f then
|
||||||
WARNING("Unable to load database: %s", e)
|
WARNING("Unable to load database: %s", e)
|
||||||
|
@ -379,6 +381,10 @@ local function load_db()
|
||||||
for _, entry in ipairs(db) do
|
for _, entry in ipairs(db) do
|
||||||
if entry.banned and entry.expires then
|
if entry.banned and entry.expires then
|
||||||
table.insert(tempbans, entry)
|
table.insert(tempbans, entry)
|
||||||
|
else
|
||||||
|
local wwe = entry
|
||||||
|
wwe.expires = now + MAX_BAN_TIME
|
||||||
|
table.insert(tempbans, )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue