forked from minetest-mods/xban2
Do not add name and IP to database in on_prejoinplayer.
This commit is contained in:
parent
e00b331554
commit
75c1be2f8e
13
init.lua
13
init.lua
|
@ -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>",
|
||||
|
|
Loading…
Reference in New Issue
Block a user