diff --git a/src/org/rev317/min/Loader.java b/src/org/rev317/min/Loader.java index 60dde95..4bc19b0 100644 --- a/src/org/rev317/min/Loader.java +++ b/src/org/rev317/min/Loader.java @@ -14,7 +14,6 @@ import org.parabot.environment.servers.ServerManifest; import org.parabot.environment.servers.ServerProvider; import org.parabot.environment.servers.Type; import org.rev317.min.accessors.Client; -import org.rev317.min.randoms.Executer; import org.rev317.min.script.ScriptEngine; import org.rev317.min.ui.BotMenu; @@ -29,8 +28,6 @@ import java.net.URL; @ServerManifest(author = "Everel & JKetelaar", name = "Server name here", type = Type.INJECTION, version = 2.1) public class Loader extends ServerProvider { private boolean extended = true; - //private HookFile hookFile = new HookFile(Context.getInstance().getServerProviderInfo().getExtendedHookFile(), HookFile.TYPE_XML); - //private HookFile hookFile = new HookFile(Context.getInstance().getServerProviderInfo().getHookFile(), HookFile.TYPE_XML); public static Client getClient() { return (Client) Context.getInstance().getClient(); @@ -102,7 +99,6 @@ public class Loader extends ServerProvider { @Override public void init() { - Executer executer = new Executer(); - executer.getRandoms(); + } } \ No newline at end of file diff --git a/src/org/rev317/min/api/methods/Bank.java b/src/org/rev317/min/api/methods/Bank.java index 41948ab..33565bf 100644 --- a/src/org/rev317/min/api/methods/Bank.java +++ b/src/org/rev317/min/api/methods/Bank.java @@ -212,7 +212,7 @@ public class Bank { */ public static void depositAllExcept(int... exceptions) { if (Bank.isOpen()) { - final ArrayList ignored = new ArrayList(); + final ArrayList ignored = new ArrayList<>(); for (int i : exceptions) { ignored.add(i); } diff --git a/src/org/rev317/min/randoms/Executer.java b/src/org/rev317/min/randoms/Executer.java deleted file mode 100644 index c35a0e8..0000000 --- a/src/org/rev317/min/randoms/Executer.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.rev317.min.randoms; - -import org.parabot.core.Context; -import org.parabot.core.Core; -import org.parabot.core.Directories; -import org.parabot.core.io.ProgressListener; -import org.parabot.environment.api.utils.WebUtil; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; - -/** - * @author JKetelaar - */ -public class Executer { - /* TODO Move to client */ - - public void getRandoms() { - Core.verbose("Downloading randoms"); - downloadRandoms(); - Core.verbose("Parsing random(s)"); - parseRandoms(); - } - - private void parseRandoms() { - File myJar = new File(Directories.getCachePath() + "/randoms.jar"); - if (!myJar.exists() || !myJar.canRead()) { - return; - } - try { - URL url = myJar.toURI().toURL(); - URL[] urls = new URL[]{url}; - String server = Context.getInstance().getServerProviderInfo().getServerName(); - - URLClassLoader child = new URLClassLoader(urls, this.getClass().getClassLoader()); - Class classToLoad = Class.forName("org.parabot.randoms.Core", true, child); - Method method = classToLoad.getDeclaredMethod("init", String.class); - Object instance = classToLoad.newInstance(); - Object result = method.invoke(instance, server); - Core.verbose("Parsed random(s)!"); - } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException | MalformedURLException e) { - e.printStackTrace(); - Core.verbose("Failed to parse random(s)..."); - } - } - - private void downloadRandoms() { - try { - File random = new File(Directories.getCachePath() + "/randoms.jar"); - if (random.exists()) { - Core.verbose("Random already exists, no need to download it."); - return; - } - String downloadLink = "http://bdn.parabot.org/api/get.php?action=randoms"; - WebUtil.downloadFile(new URL(downloadLink), random, new ProgressListener() { - @Override - public void onProgressUpdate(double v) { - - } - - @Override - public void updateDownloadSpeed(double v) { - - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - } -}