Search in sources :

Example 1 with ProxyObject

use of main.java.sneakerbot.loaders.Proxy.ProxyObject in project SneakerBot by Penor.

the class Bot method init.

public static void init() {
    taskCount = 0;
    usedAccounts = 0;
    accounts = AdidasAccount.load("data/accounts.txt");
    proxies = Proxy.load("data/proxies.txt");
    usedProxies = new ArrayList<ProxyObject>();
    credentials = Credentials.load("data/credentials.json");
    configs = Config.load("data/config.json");
    captchas = new ArrayList<CaptchaResponse>();
    for (Object config : configs.stream().toArray()) taskCount += (int) ((ConfigObject) config).getTasks();
    pool = new ThreadPool(taskCount);
}
Also used : ProxyObject(main.java.sneakerbot.loaders.Proxy.ProxyObject) CaptchaResponse(main.java.sneakerbot.captcha.Harvester.CaptchaResponse) ThreadPool(main.java.sneakerbot.thread.ThreadPool) CredentialObject(main.java.sneakerbot.loaders.Credentials.CredentialObject) AccountObject(main.java.sneakerbot.loaders.AdidasAccount.AccountObject) ProxyObject(main.java.sneakerbot.loaders.Proxy.ProxyObject) ConfigObject(main.java.sneakerbot.loaders.Config.ConfigObject)

Example 2 with ProxyObject

use of main.java.sneakerbot.loaders.Proxy.ProxyObject in project SneakerBot by Penor.

the class Bot method getRandomProxy.

public static ProxyObject getRandomProxy() {
    int proxyCount = proxies.size();
    int usedCount = usedProxies.size();
    if (proxyCount == 0 && usedCount == 0)
        return null;
    int index = new Random().nextInt(proxyCount != 0 ? proxyCount : usedCount);
    if (proxyCount != 0) {
        ProxyObject proxy = proxies.remove(index);
        usedProxies.add(proxy);
        return proxy;
    } else
        return usedProxies.get(index);
}
Also used : ProxyObject(main.java.sneakerbot.loaders.Proxy.ProxyObject) Random(java.util.Random)

Aggregations

ProxyObject (main.java.sneakerbot.loaders.Proxy.ProxyObject)2 Random (java.util.Random)1 CaptchaResponse (main.java.sneakerbot.captcha.Harvester.CaptchaResponse)1 AccountObject (main.java.sneakerbot.loaders.AdidasAccount.AccountObject)1 ConfigObject (main.java.sneakerbot.loaders.Config.ConfigObject)1 CredentialObject (main.java.sneakerbot.loaders.Credentials.CredentialObject)1 ThreadPool (main.java.sneakerbot.thread.ThreadPool)1