Improved bot

This commit is contained in:
JKetelaar
2014-08-06 22:51:35 +02:00
parent 0b917919a4
commit 14156c967e
9 changed files with 57 additions and 29 deletions
@@ -154,7 +154,5 @@ public class Script implements Runnable {
public final void sleep(int ms) {
Time.sleep(ms);
}
}
@@ -1,11 +1,5 @@
package org.parabot.environment.scripts.executers;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.JOptionPane;
import org.parabot.core.Configuration;
import org.parabot.core.classpath.ClassPath;
import org.parabot.core.forum.AccountManager;
@@ -15,6 +9,11 @@ import org.parabot.environment.api.utils.WebUtil;
import org.parabot.environment.scripts.Script;
import org.parabot.environment.scripts.loader.JavaScriptLoader;
import javax.swing.*;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLConnection;
/**
*
* Loads a script from the SDN
@@ -44,7 +43,7 @@ public class SDNScriptExecuter extends ScriptExecuter {
@Override
public void run(ThreadGroup tg) {
try {
final URLConnection urlConnection = WebUtil.getConnection(new URL(String.format(Configuration.GET_SDN_SCRIPT, manager.getAccount().getUsername(), manager.getAccount().getPassword(), this.id)));
final URLConnection urlConnection = WebUtil.getConnection(new URL(String.format(Configuration.GET_SDN_SCRIPT, manager.getAccount().getURLUsername(), manager.getAccount().getURLPassword(), this.id)));
final String contentType = urlConnection.getHeaderField("Content-type");
if(contentType.equals("text/html")) {
// failed to fetch script
@@ -52,7 +52,7 @@ public class PublicServerExecuter extends ServerExecuter {
public void run() {
try {
ServerProviderInfo serverProviderInfo = new ServerProviderInfo(new URL(Configuration.GET_SERVER_PROVIDER_INFO
+ this.serverID), manager.getAccount().getUsername(), manager.getAccount().getPassword());
+ this.serverID), manager.getAccount().getURLUsername(), manager.getAccount().getURLPassword());
final File destination = new File(Directories.getCachePath(),
serverProviderInfo.getCRC32() + ".jar");
@@ -66,7 +66,7 @@ public class PublicServerExecuter extends ServerExecuter {
Core.verbose("Found cached server provider [CRC32: " + serverProviderInfo.getCRC32() + "]");
} else {
WebUtil.downloadFile(new URL(jarUrl), destination,
VerboseLoader.get(), manager.getAccount().getUsername(), manager.getAccount().getPassword());
VerboseLoader.get(), manager.getAccount().getURLUsername(), manager.getAccount().getURLPassword());
Core.verbose("Server provider downloaded...");
}