Exemplo n.º 1
0
        internal void newTask(int cooldown = 0)
        {
            MinecraftBot connection;

            try
            {
                while (TaskWorking)
                {
                    if (Bots.Count < threads)
                    {
                        if (proxyip.Count <= 0)
                        {
                            ConsoleIO.AddMsgSeq("正在获取代理...", "Proxy");
                            HttpReq.getips_(proxyip);
                        }
                        connection          = new MinecraftBot(Info.ServerIP, Info.ServerPort, username, protocol, Info.ForgeInfo, this);
                        connection.Chatlist = Chat;
                        connection.AddPlayer();

                        Thread.Sleep(cooldown);
                    }
                    else
                    {
                        Clear();
                    }
                }
            }
            catch (Exception e)
            {
                ConsoleIO.AddMsgSeq(e.Message, "Error");
            }
        }
Exemplo n.º 2
0
        internal void newTask(int cooldown = 0)
        {
            MinecraftBot client;
            Thread       socksThread = new Thread(getProxys);

            socksThread.Start();
            new Thread(new ThreadStart(Clear)).Start();
            new Thread(new ThreadStart(() =>
            {
                try
                {
                    while (TaskWorking)
                    {
                        while (Bots.Count < threads)
                        {
                            if (socks_pool.Count > 0)
                            {
                                client = new MinecraftBot(socks_pool[0], Info.ServerIP, Info.ServerPort, protocol, Info.ForgeInfo, this);
                                Bots.Add(client);
                                client.Chatlist = Chat;
                                client.AddPlayer(username);
                                socks_pool.RemoveAt(0);
                                Thread.Sleep(cooldown);
                            }
                            else
                            {
                                Thread.Sleep(1000);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    ConsoleIO.AddMsgSeq(e.Message, "Error");
                }
            })).Start();
        }