add new joinrules
no guests, not too short names, not too long names, not too many numbers in names, not only numbers in names
This commit is contained in:
parent
387e52f7a9
commit
1c6d2049ff
1
init.lua
1
init.lua
@ -1,3 +1,4 @@
|
||||
dofile(minetest.get_modpath("illuna").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("illuna").."/crafting.lua")
|
||||
dofile(minetest.get_modpath("illuna").."/commands.lua")
|
||||
dofile(minetest.get_modpath("illuna").."/register.lua")
|
||||
|
27
register.lua
Normal file
27
register.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local disallowed = {
|
||||
["guest"] = "Guest accounts are disallowed on this server. "..
|
||||
"Please choose a proper username and try again.",
|
||||
["^[0-9]+$"] = "All-numeric usernames are disallowed on this server. "..
|
||||
"Please choose a proper username and try again.",
|
||||
["[0-9].-[0-9].-[0-9].-[0-9].-[0-9]"] = "Too many numbers in your username. "..
|
||||
"Please try again with less than five digits in your username."
|
||||
}
|
||||
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 #name < 2 then
|
||||
return "Too short of a username. "..
|
||||
"Please pick a name with at least two letters and try again."
|
||||
end
|
||||
|
||||
if #name > 30 then
|
||||
return "Too long username. "..
|
||||
"Please pick a name with no more 30 letters and try again."
|
||||
end
|
||||
|
||||
end)
|
Loading…
x
Reference in New Issue
Block a user