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);
}
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);
}
Aggregations