Merge pull request #3 from Athemis/master
[MineClone.git] / mods / command / init.lua
blobf28f0edbf59c7b6e56d7bc35b3f5413e9b62db16
1 local path = minetest.get_modpath(minetest.get_current_modname())
4 -- Load Info command
5 dofile(path.."/info.lua")
7 -- Load GM command
8 dofile(path.."/gm.lua")
10 -- Load time command
11 dofile(path.."/time.lua")
13 -- Load kits command
14 dofile(path.."/kits.lua")
16 -- Load debug command
17 dofile(path.."/debug.lua")
19 -- By VanessaE, sfan5, and kaeza.
20 local disallowed = {
21 ["guest"] = "Guest accounts are disallowed on this server. "..
22 "Please choose a proper username and try again.",
23 ["^[0-9]+$"] = "All-numeric usernames are disallowed on this server. "..
24 "Please choose a proper username and try again.",
25 ["[0-9].-[0-9].-[0-9].-[0-9].-[0-9]"] = "Too many numbers in your username. "..
26 "Please try again with less than five digits in your username."
28 minetest.register_on_prejoinplayer(function(name, ip)
29 local lname = name:lower()
30 for re, reason in pairs(disallowed) do
31 if lname:find(re) then
32 return reason
33 end
34 end
36 if #name < 2 then
37 return "Too short of a username. "..
38 "Please pick a name with at least two letters and try again."
39 end
41 if #name > 30 then
42 return "Too long username. "..
43 "Please pick a name with no more 30 letters and try again."
44 end
46 end)