Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
many prejoin functions is bad, now 1 prejoin for all test
  • Loading branch information
Crabman77 committed Dec 18, 2016
1 parent a560b38 commit 19167a0
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ do
end
end

minetest.register_on_prejoinplayer(function(name, ip)
local lname = name:lower()
for re, reason in pairs(disallowed) do
if lname:find(re) then
return reason
end
end
if disallowed_names[lname] then
return "Sorry. This name is forbidden."
end
end)

--------------------------------------
-- Simple matching config reloading --
Expand Down Expand Up @@ -130,20 +119,6 @@ minetest.register_chatcommand("forbidden_names_reload", {
-- Case-insensitivity --
------------------------

minetest.register_on_prejoinplayer(function(name, ip)
local lname = name:lower()
local enumerate, e1, e2, e3 = minetest.get_auth_handler().enumerate_auths
if enumerate then e1 = enumerate() else e1, e2, e3 = pairs(minetest.auth_table) end
for iname, data in e1, e2, e3 do
if iname:lower() == lname and iname ~= name then
return "Sorry, someone else is already using this"
.." name. Please pick another name."
.." Another possibility is that you used the"
.." wrong case for your name."
end
end
end)

-- Compatability, for old servers with conflicting players
minetest.register_chatcommand("choosecase", {
description = "Choose the casing that a player name should have",
Expand Down Expand Up @@ -214,6 +189,31 @@ all_chars = all_chars .. "]"


minetest.register_on_prejoinplayer(function(name, ip)
--MFF crabman (fix new player disallow old player with similaire name)
local exists = minetest.get_auth_handler().get_auth(name)
if exists then return end

local lname = name:lower()
for re, reason in pairs(disallowed) do
if lname:find(re) then
return reason
end
end
if disallowed_names[lname] then
return "Sorry. This name is forbidden."
end

local enumerate, e1, e2, e3 = minetest.get_auth_handler().enumerate_auths
if enumerate then e1 = enumerate() else e1, e2, e3 = pairs(minetest.auth_table) end
for iname, data in e1, e2, e3 do
if iname:lower() == lname and iname ~= name then
return "Sorry, someone else is already using this"
.." name. Please pick another name."
.." Another possibility is that you used the"
.." wrong case for your name."
end
end

if exemptions[name] then return end

-- Generate a regular expression to match all similar names
Expand Down

0 comments on commit 19167a0

Please sign in to comment.