Mineclonia/mods/command/init.lua

47 lines
1.2 KiB
Lua
Raw Normal View History

2015-06-29 17:55:56 +00:00
local path = minetest.get_modpath(minetest.get_current_modname())
2015-07-04 02:56:02 +00:00
2015-06-29 17:55:56 +00:00
-- Load Info command
dofile(path.."/info.lua")
2015-07-04 02:56:02 +00:00
-- Load GM command
dofile(path.."/gm.lua")
2015-06-29 17:55:56 +00:00
-- Load time command
dofile(path.."/time.lua")
-- Load kits command
dofile(path.."/kits.lua")
2015-07-04 02:56:02 +00:00
-- Load debug command
dofile(path.."/debug.lua")
2015-06-29 17:55:56 +00:00
-- By VanessaE, sfan5, and kaeza.
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)