Exemplo n.º 1
0
        /// <summary>
        /// Connects to a minecraft server. 
        /// </summary>
        /// <param name="serverNameOrUrl">Can be the name of the server, the full server play url, or left blank.</param>
        /// <param name="isUrl">Set this to true if 'ServerNameorUrl' is a play url.</param>
        /// <param name="ip">Ip of the server to connect to. Use this if verify names is off.</param>
        /// <param name="port">Port of the server to connect to. Use this if verify names is off.</param>
        public void Connect(string serverNameOrUrl, bool isUrl, string ip="", int port=0)
        {
            if (VerifyNames) {
                var ls = new ClassicubeInteraction(Username, Password);

                if (!ls.Login()) {
                    RaiseErrorMessage("Failed to verify name.");
                    return;
                }

                var myServer = isUrl ? ls.GetServerByUrl(serverNameOrUrl) : ls.GetServerInfo(serverNameOrUrl);

                Ip = myServer.Ip;
                Port = myServer.Port;
                MpPass = myServer.Mppass;
            } else {
                Ip = ip;
                Port = port;
            }

            Entities = new Dictionary<sbyte, Entity>();
            ClientWorld = new WorldContainer();

            Nm = new NetworkManager(this);
            Nm.Connect();
        }
Exemplo n.º 2
0
        private void Settings_Load(object sender, EventArgs e)
        {
            _sFile = Mf.ProgramSettings.RegisterFile("Settings.ini", true, LoadSettings);
            Mf.ProgramSettings.ReadSettings(_sFile);

            LoginWorker = new ClassicubeInteraction(Username, Password);

            txtUN.Text = Username;
            txtPW.Text = Password;
            //txtPort.Text = _port.ToString();
            chkVerify.Checked = _verifyNames;
        }