diff options
author | Diego Martinez <kaeza@users.sf.net> | 2014-06-17 03:22:29 -0300 |
---|---|---|
committer | Diego Martinez <kaeza@users.sf.net> | 2014-06-17 03:22:29 -0300 |
commit | 75c1be2f8e3f3293b449ed07555bbd8a6d40e356 (patch) | |
tree | 6863fe88712c82b9bfb9a04f021b5b7e96bf5e06 | |
parent | e00b33155425de30fbe0a22e49f1695eb15fa02c (diff) | |
download | xban2-75c1be2f8e3f3293b449ed07555bbd8a6d40e356.tar.gz xban2-75c1be2f8e3f3293b449ed07555bbd8a6d40e356.tar.bz2 xban2-75c1be2f8e3f3293b449ed07555bbd8a6d40e356.zip |
Do not add name and IP to database in on_prejoinplayer.
-rw-r--r-- | init.lua | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -131,9 +131,8 @@ function xban.unban_player(player, source) --> bool, err end minetest.register_on_prejoinplayer(function(name, ip) - local e = xban.find_entry(name) or xban.find_entry(ip, true) - e.names[name] = true - e.names[ip] = true + 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") @@ -142,6 +141,14 @@ minetest.register_on_prejoinplayer(function(name, ip) end end) +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + local ip = minetest.get_player_ip(name) + local e = xban.find_entry(name) or xban.find_entry(ip, true) + e.names[name] = true + e.names[ip] = true +end) + minetest.register_chatcommand("xban", { description = "XBan a player", params = "<player> <reason>", |