mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-04 08:39:23 +00:00
Changed package
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
package org.rev317.min;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.asm.ASMClassLoader;
|
||||
import org.parabot.core.asm.adapters.AddInterfaceAdapter;
|
||||
import org.parabot.core.asm.hooks.HookFile;
|
||||
import org.parabot.environment.scripts.Script;
|
||||
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.script.ScriptEngine;
|
||||
import org.rev317.min.ui.BotMenu;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Everel
|
||||
*
|
||||
*/
|
||||
@ServerManifest(author = "Everel", name = "Local Client", type = Type.INJECTION, version = 0.1)
|
||||
public class Loader extends ServerProvider {
|
||||
private Applet applet;
|
||||
|
||||
@Override
|
||||
public Applet fetchApplet() {
|
||||
try {
|
||||
final Context context = Context.getInstance();
|
||||
final ASMClassLoader classLoader = context.getASMClassLoader();
|
||||
final Class<?> clientClass = classLoader.loadClass("Client");
|
||||
Object instance = clientClass.newInstance();
|
||||
applet = (Applet) instance;
|
||||
return applet;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getJar() {
|
||||
try {
|
||||
return new File("D:/317client.jar").toURI().toURL();
|
||||
} catch(Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Client getClient() {
|
||||
return (Client) Context.getInstance().getClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMenuItems(JMenuBar bar) {
|
||||
new BotMenu(bar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectHooks() {
|
||||
AddInterfaceAdapter.setAccessorPackage("org/rev317/accessors/");
|
||||
// default injection is done by bot, it basically parses the hooks file
|
||||
super.injectHooks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initScript(Script script) {
|
||||
ScriptEngine.getInstance().setScript(script);
|
||||
ScriptEngine.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HookFile getHookFile() {
|
||||
try {
|
||||
return new HookFile(new URL("http://bot.parabot.org/hooks/317api_hooks_min.xml"), HookFile.TYPE_XML);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void unloadScript(Script script) {
|
||||
ScriptEngine.getInstance().unload();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user