Merge pull request #293 from AlexanderBielen/feature/add-hook-report-button

Add hook report button
This commit is contained in:
Jeroen Ketelaar
2018-12-04 18:33:01 -06:00
committed by GitHub
3 changed files with 25 additions and 4 deletions
@@ -18,10 +18,12 @@ public class Configuration extends org.parabot.api.Configuration {
public static final String GET_BOT_VERSION = "http://bdn.parabot.org/api/v2/bot/version";
public static final String API_DOWNLOAD_BOT = "http://v3.bdn.parabot.org/api/bot/download/client";
public static final String DOWNLOAD_BOT = "http://bdn.parabot.org/versions/";
public static final String REGISTRATION_PAGE = "https://www.parabot.org/community/register/";
public static final String GET_RANDOMS = "http://v3.bdn.parabot.org/api/bot/download/randoms";
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
public static final String ITEM_API = DATA_API + "items/";
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
public static final String COMMUNITY_PAGE = "https://www.parabot.org/community/";
public static final String REGISTRATION_PAGE = COMMUNITY_PAGE + "register/";
}
@@ -30,4 +30,13 @@ public class UILog {
public static int alert(final String title, final String message, int optionType, int messageType) {
return JOptionPane.showConfirmDialog(null, message, title, optionType, messageType);
}
public static int alert(final String title, final String message, Object[] options) {
return alert(title, message, options, JOptionPane.INFORMATION_MESSAGE);
}
public static int alert(final String title, final String message, Object[] options, int messageType) {
return JOptionPane.showOptionDialog(null, message, title,
JOptionPane.YES_NO_CANCEL_OPTION, messageType, null, options, null);
}
}
@@ -1,6 +1,7 @@
package org.parabot.environment.servers;
import org.objectweb.asm.Opcodes;
import org.parabot.core.Configuration;
import org.parabot.core.Context;
import org.parabot.core.asm.hooks.HookFile;
import org.parabot.core.asm.interfaces.Injectable;
@@ -14,6 +15,8 @@ import javax.swing.*;
import java.applet.Applet;
import java.applet.AppletStub;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
/**
@@ -92,8 +95,15 @@ public abstract class ServerProvider implements Opcodes {
if(!crashed) {
Injectable inj = injectables[index];
UILog.log("Outdated client", "This server currently has outdated hooks, please report it to a member of the Parabot staff/Dev Team.\r\n\r\n" +
"Broken hook:\r\n"+inj, JOptionPane.ERROR_MESSAGE);
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" +
"Broken hook:\r\n"+inj, new Object[]{"Close", "Report here..."}, JOptionPane.ERROR_MESSAGE);
if(resp == 1) {
URI uri = URI.create(Configuration.COMMUNITY_PAGE + "forum/135-reports/");
try {
Desktop.getDesktop().browse(uri);
} catch (IOException ignore) {}
}
}
crashed = true;
throw ex;