[TASK] Formatted code

This commit is contained in:
Jeroen Ketelaar
2019-05-21 22:12:18 -05:00
parent aab8d78d1e
commit f67d0ce985
2 changed files with 28 additions and 26 deletions
@@ -77,7 +77,7 @@ public abstract class ServerProvider implements Opcodes {
return; return;
} }
HookParser parser = hookFile.getParser(); HookParser parser = hookFile.getParser();
Injectable[] injectables = parser.getInjectables(); Injectable[] injectables = parser.getInjectables();
if (injectables == null) { if (injectables == null) {
@@ -92,17 +92,18 @@ public abstract class ServerProvider implements Opcodes {
index++; index++;
} }
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
if(!crashed) { if (!crashed) {
Injectable inj = injectables[index]; Injectable inj = injectables[index];
int resp = UILog.alert("Outdated client", "This server currently has outdated hooks, please report it to a member of the Parabot staff.\r\n\r\n" + int resp = UILog.alert("Outdated client", "This server currently has outdated hooks, please report it to the Parabot staff.\r\n\r\n" +
"Broken hook:\r\n"+inj, new Object[]{"Close", "Report here..."}, JOptionPane.ERROR_MESSAGE); "Broken hook:\r\n" + inj, new Object[]{ "Close", "Report here..." }, JOptionPane.ERROR_MESSAGE);
if(resp == 1) { if (resp == 1) {
URI uri = URI.create(Configuration.COMMUNITY_PAGE + "forum/135-reports/"); URI uri = URI.create(Configuration.COMMUNITY_PAGE + "forum/135-reports/");
try { try {
Desktop.getDesktop().browse(uri); Desktop.getDesktop().browse(uri);
} catch (IOException ignore) {} } catch (IOException ignore) {
}
} }
} }
crashed = true; crashed = true;
@@ -112,20 +113,6 @@ public abstract class ServerProvider implements Opcodes {
Context.getInstance().setHookParser(parser); Context.getInstance().setHookParser(parser);
} }
private HookFile fetchHookFile() {
HookFile hookFile = getHookFile();
if (hookFile != null) {
return hookFile;
}
URL hookLocation = getHooks();
if (hookLocation == null) {
return null;
}
return new HookFile(hookLocation, HookFile.TYPE_XML);
}
/** /**
* Add custom items to the bot menu bar * Add custom items to the bot menu bar
* *
@@ -156,16 +143,16 @@ public abstract class ServerProvider implements Opcodes {
public void initMouse() { public void initMouse() {
final Context context = Context.getInstance(); final Context context = Context.getInstance();
final Applet applet = context.getApplet(); final Applet applet = context.getApplet();
final Mouse mouse = new Mouse(applet); final Mouse mouse = new Mouse(applet);
applet.addMouseListener(mouse); applet.addMouseListener(mouse);
applet.addMouseMotionListener(mouse); applet.addMouseMotionListener(mouse);
context.setMouse(mouse); context.setMouse(mouse);
} }
public void initKeyboard() { public void initKeyboard() {
final Context context = Context.getInstance(); final Context context = Context.getInstance();
final Applet applet = context.getApplet(); final Applet applet = context.getApplet();
final Keyboard keyboard = new Keyboard(applet); final Keyboard keyboard = new Keyboard(applet);
applet.addKeyListener(keyboard); applet.addKeyListener(keyboard);
context.setKeyboard(keyboard); context.setKeyboard(keyboard);
@@ -191,4 +178,18 @@ public abstract class ServerProvider implements Opcodes {
} }
private HookFile fetchHookFile() {
HookFile hookFile = getHookFile();
if (hookFile != null) {
return hookFile;
}
URL hookLocation = getHooks();
if (hookLocation == null) {
return null;
}
return new HookFile(hookLocation, HookFile.TYPE_XML);
}
} }
@@ -29,8 +29,9 @@ public class ServerLoader extends ASMClassLoader {
public final String[] getServerClassNames() { public final String[] getServerClassNames() {
final List<String> classNames = new ArrayList<String>(); final List<String> classNames = new ArrayList<String>();
for (ClassNode c : classPath.classes.values()) { for (ClassNode c : classPath.classes.values()) {
if (c.superName.replace('/', '.').equals( if (c.superName
ServerProvider.class.getName())) { .replace('/', '.')
.equals(ServerProvider.class.getName())) {
classNames.add(c.name.replace('/', '.')); classNames.add(c.name.replace('/', '.'));
} }
} }