Beispiel #1
0
        void HandleLogin(byte[] packet)
        {
            LastAction = DateTime.UtcNow;
            if (loggedIn)
            {
                return;
            }
            byte version = packet[1];

            if (version != Server.version)
            {
                Leave(null, "Wrong version!", true); return;
            }

            name     = NetUtils.ReadString(packet, 2);
            skinName = name; DisplayName = name; truename = name;
            if (Server.ClassicubeAccountPlus)
            {
                name += "+";
            }

            string mppass = NetUtils.ReadString(packet, 66);

            if (PlayerConnecting != null)
            {
                PlayerConnecting(this, mppass);
            }
            OnPlayerConnectingEvent.Call(this, mppass);
            if (cancelconnecting)
            {
                cancelconnecting = false; return;
            }

            isDev = Server.Devs.CaselessContains(truename);
            isMod = Server.Mods.CaselessContains(truename);

            byte type = packet[130];

            Loading = true;
            if (disconnected)
            {
                return;
            }
            id = NextFreeId();

            if (type == 0x42)
            {
                hasCpe = true; SendCpeExtensions();
            }
            if (type != 0x42)
            {
                CompleteLoginProcess();
            }
        }
Beispiel #2
0
        void HandleLogin(byte[] buffer, int offset)
        {
            LastAction = DateTime.UtcNow;
            if (loggedIn)
            {
                return;
            }
            byte version = buffer[offset + 1];

            if (version != Server.version)
            {
                Leave(null, "Wrong version!", true); return;
            }

            name     = NetUtils.ReadString(buffer, offset + 2);
            SkinName = name; DisplayName = name; truename = name;
            if (ServerConfig.ClassicubeAccountPlus)
            {
                name += "+";
            }

            string mppass = NetUtils.ReadString(buffer, offset + 66);

            OnPlayerConnectingEvent.Call(this, mppass);
            if (cancelconnecting)
            {
                cancelconnecting = false; return;
            }

            byte protocolType = buffer[offset + 130];

            Loading = true;
            if (disconnected)
            {
                return;
            }

            if (protocolType == 0x42)
            {
                hasCpe = true; SendCpeExtensions();
            }
            if (protocolType != 0x42)
            {
                CompleteLoginProcess();
            }
        }