static bool HandleConnectingCore(Player p, string mppass)
        {
            if (p.truename.Length > 16)
            {
                p.Leave(null, "Usernames must be 16 characters or less", true); return(false);
            }
            if (!Player.ValidName(p.truename))
            {
                p.Leave(null, "Invalid player name", true); return(false);
            }

            if (!VerifyName(p, mppass))
            {
                return(false);
            }
            if (!IPThrottler.CheckIP(p))
            {
                return(false);
            }
            if (!CheckPendingAlts(p))
            {
                return(false);
            }
            if (!CheckTempban(p))
            {
                return(false);
            }

            bool whitelisted = CheckWhitelist(p.name, p.ip);

            if (!whitelisted)
            {
                p.Leave(null, "This is a private server!", true);
                return(false);
            }

            Group group = Group.GroupIn(p.name);

            if (!CheckBanned(group, p, whitelisted))
            {
                return(false);
            }
            if (!CheckPlayersCount(group, p))
            {
                return(false);
            }
            if (!CheckOnlinePlayers(p))
            {
                return(false);
            }
            p.group = group;
            return(true);
        }
Exemple #2
0
        static bool HandleConnectingCore(Player p, string mppass)
        {
            if (p.truename.Length > 16)
            {
                p.Leave(null, "Usernames must be 16 characters or less", true);
                return(false);
            }
            if (!Player.ValidName(p.truename))
            {
                p.Leave(null, "Invalid player name", true);
                return(false);
            }

            if (!VerifyName(p, mppass))
            {
                return(false);
            }
            if (!IPThrottler.CheckIP(p))
            {
                return(false);
            }
            if (!CheckTempban(p))
            {
                return(false);
            }

            if (Server.Config.WhitelistedOnly && !Server.whiteList.Contains(p.name))
            {
                p.Leave(null, Server.Config.DefaultWhitelistMessage, true);
                return(false);
            }

            p.group = Group.GroupIn(p.name);
            if (!CheckBanned(p))
            {
                return(false);
            }
            if (!CheckPlayersCount(p))
            {
                return(false);
            }
            return(true);
        }