mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 08:39:12 +00:00
Updates
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package org.parabot.environment.api.interfaces;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Clisprail
|
||||
*
|
||||
*/
|
||||
public interface Paintable {
|
||||
|
||||
public void paint(Graphics g);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.parabot.environment.api.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -69,15 +71,28 @@ public class WebUtil {
|
||||
*/
|
||||
public static BufferedReader getReader(final URL url) {
|
||||
try {
|
||||
final URLConnection con = getConnection(url);
|
||||
return new BufferedReader(new InputStreamReader(
|
||||
con.getInputStream()));
|
||||
return new BufferedReader(new InputStreamReader(getInputStream(url)));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets inputstream from url
|
||||
* @param url
|
||||
* @return inputstream from url
|
||||
*/
|
||||
public static InputStream getInputStream(final URL url) {
|
||||
final URLConnection con = getConnection(url);
|
||||
try {
|
||||
return con.getInputStream();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a connection
|
||||
* @param url
|
||||
|
||||
@@ -5,51 +5,74 @@ import java.applet.AppletStub;
|
||||
import java.net.URL;
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.asm.interfaces.Injectable;
|
||||
import org.parabot.core.parsers.HookParser;
|
||||
|
||||
/**
|
||||
* Provides a server to the bot
|
||||
*
|
||||
*
|
||||
* @author Clisprail
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class ServerProvider {
|
||||
|
||||
public abstract class ServerProvider implements Opcodes {
|
||||
|
||||
/**
|
||||
* Hooks to parse
|
||||
*
|
||||
* @return URL to hooks file
|
||||
*/
|
||||
public URL getHooks() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Jar to parse
|
||||
*
|
||||
* @return URL to client jar
|
||||
*/
|
||||
public abstract String getJar();
|
||||
|
||||
public abstract URL getJar();
|
||||
|
||||
public abstract Applet fetchApplet();
|
||||
|
||||
|
||||
public String getAccessorsPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void inject(ClassNode node) {
|
||||
|
||||
|
||||
public void injectHooks() {
|
||||
URL hooksFile = getHooks();
|
||||
if (hooksFile == null) {
|
||||
System.out.println("null");
|
||||
return;
|
||||
}
|
||||
HookParser parser = new HookParser(hooksFile);
|
||||
Injectable[] injectables = parser.getInjectables();
|
||||
if (injectables == null) {
|
||||
return;
|
||||
}
|
||||
for (Injectable inj : injectables) {
|
||||
inj.inject();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add custom items to the bot menu bar
|
||||
* @param menu bar to add items on
|
||||
*
|
||||
* @param menu
|
||||
* bar to add items on
|
||||
*/
|
||||
public void addMenuItems(JMenuBar bar) {
|
||||
}
|
||||
|
||||
|
||||
public AppletStub getStub() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setClientInstance(Object client) {
|
||||
Context.resolve().setClientInstance(client);
|
||||
}
|
||||
|
||||
public void parseJar() {
|
||||
Context.resolve().getClassPath().addJar(getJar());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user