Esempio n. 1
0
 internal void AddPlayer()
 {
     mainThread = new Thread(new ThreadStart(() =>
     {
         try
         {
             bots.Bots.Add(this);
             if (Setting.sendmotd)
             {
                 Tcp = getProxyClient();
                 SendMotd(Tcp);
                 Thread.Sleep(300);
             }
             Tcp = getProxyClient();
             Tcp.ReceiveTimeout = 10000;
             Tcp.SendTimeout    = 10000;
             client             = new MinecraftProtocol(Tcp, ProtocolVersion, this, forgeInfo);
             if (client.Login(Host, Port, playername))
             {
                 if (Setting.t_tabcomplete > 0)
                 {
                     TabComplete();
                 }
                 ConsoleIO.AddMsgSeq(playername + " Join the game", "Player");
                 client.StartUpdating(false);
             }
         }
         catch
         {
             Dispose();
         }
     }));
     mainThread.Start();
 }
Esempio n. 2
0
 internal bool AddPlayer(string username = null)
 {
     if (Tcp.Connected)
     {
         if (username != null)
         {
             playername = username.Replace("%RANDOM%", randomName());
         }
         try
         {
             client = new MinecraftProtocol(Tcp, ProtocolVersion, this, forgeInfo);
             if (client.Login(Host, Port, playername))
             {
                 if (Setting.t_tabcomplete > 0)
                 {
                     TabComplete();
                 }
                 return(true);
             }
         }
         catch
         {
             Dispose();
         }
     }
     else
     {
         Dispose();
     }
     return(false);
 }
Esempio n. 3
0
 internal void AddPlayer()
 {
     clientthread = new Thread(new ThreadStart(() =>
     {
         try
         {
             bool motdview = true;
             if (Setting.MotdSend)
             {
                 Tcp = new TcpClient();
                 Tcp.Connect(ProxyIP, ProxyPort);
                 if (proxyip().Contains("200"))
                 {
                     SendMotd(Tcp);
                 }
                 else
                 {
                     motdview = false;
                 }
             }
             Tcp = new TcpClient();
             Tcp.Connect(ProxyIP, ProxyPort);
             if (motdview)
             {
                 if (proxyip().Contains("200"))
                 {
                     client = new MinecraftProtocol(Tcp, ProtocolVersion, this, forgeInfo);
                     client.Handshake(Host, Port);
                     if (client.Login(playername))
                     {
                         if (Setting.TabComplete)
                         {
                             TabComplete();
                         }
                     }
                 }
                 else
                 {
                     Stop();
                     bots.Bots.Remove(this);
                 }
             }
         }
         catch {
             Stop();
             bots.Bots.Remove(this);
         }
     }));
     clientthread.IsBackground = true;
     clientthread.Start();
 }