diff options
author | gpcf <gpcf@gpcf.eu> | 2024-07-28 11:46:19 +0200 |
---|---|---|
committer | gpcf <gpcf@gpcf.eu> | 2024-07-28 11:46:19 +0200 |
commit | c7f0dbbbdac8ffdc4d6b90eb38a2221977f36666 (patch) | |
tree | 987b1771719ffdd2c3a51796fa34368a01529921 | |
parent | 8d9fe6845ecd8a14de2c973547d3ae98107d635f (diff) | |
download | xban2-c7f0dbbbdac8ffdc4d6b90eb38a2221977f36666.tar.gz xban2-c7f0dbbbdac8ffdc4d6b90eb38a2221977f36666.tar.bz2 xban2-c7f0dbbbdac8ffdc4d6b90eb38a2221977f36666.zip |
Add unit tests, fix broken new player handling
-rw-r--r-- | init.lua | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -313,14 +313,6 @@ minetest.register_chatcommand("is_afk", { minetest.register_on_prejoinplayer(function(name, ip) local wl = db.whitelist or { } if wl[name] or wl[ip] then return end - local e = xban.find_entry(name) or xban.find_entry(ip) - if not e then return end - if e.banned then - local date = (e.expires and os.date("%c", e.expires) - or "the end of time") - return ("Banned: Expires: %s, Reason: %s"):format( - date, e.reason) - end if minetest.player_exists(name) and not xban.has_password(name) then ACTION("Passwordless account %s attempted to log in", name) return "This account has been deactivated. Please, contact the server owner on the forums." @@ -333,8 +325,17 @@ minetest.register_on_prejoinplayer(function(name, ip) return end end + ACTION("New player %s tried to join while no active moderators were present, rejected.", name) return "No new accounts are allowed while there is no moderator online. Please try rejoining later!" end + local e = xban.find_entry(name) or xban.find_entry(ip) + if not e then return end + if e.banned then + local date = (e.expires and os.date("%c", e.expires) + or "the end of time") + return ("Banned: Expires: %s, Reason: %s"):format( + date, e.reason) + end end) minetest.register_on_newplayer(function(player) |