Esempio n. 1
0
        static int RaiseCheckingPlayerLoginEvent(Player player, String name, String verificationCode)
        {
            var h    = CheckingPlayerLogin;
            var args = new CheckingPlayerLoginEventArgs(player, name, verificationCode);

            if (h != null)
            {
                h(null, args);
            }

            if (args.Abort)
            {
                return(1);
            }
            if (args.Verify)
            {
                return(2);
            }
            return(0);
        }
Esempio n. 2
0
        public static void OnCheckingPlayerLogin(object sender, CheckingPlayerLoginEventArgs e)
        {
            PlayerInfo Info = PlayerDB.FindPlayerInfoExact(e.Name);

            bool ipMatch  = false;
            bool lowLevel = true;

            if (Info != null)
            {
                if (Info.TimesVisited > 1 && Info.LastIP.Equals(e.Player.IP))
                {
                    ipMatch = true;
                }
                if (Info.Rank.Can(Permission.Kick))
                {
                    lowLevel = false;
                }
            }
            bool verifyMain = Server.VerifyName(e.Name, e.VerificationCode, NKMods.mainSalt);
            bool verifyWom  = Server.VerifyName(e.Name, e.VerificationCode, NKMods.womSalt);

            if (verifyMain || (ipMatch && lowLevel) || (verifyWom && lowLevel) || (verifyWom && ipMatch))
            {
                e.Verify = true;
                return;
            }

            if (verifyWom && !lowLevel)
            {
                e.Player.KickNow("You cannot connect via WoM Direct at your rank", LeaveReason.UnverifiedName);
                e.Abort = true;
                return;
            }

            e.Player.KickNow("It seems that minecraft.net authentication is down, sorry.", LeaveReason.UnverifiedName);
            e.Abort = true;
            return;
        }