[CLEANUP] Removed Bugsnag from project

This commit is contained in:
JKetelaar
2016-05-24 15:24:00 +02:00
parent f75f172d35
commit 463ef6cea8
7 changed files with 122 additions and 175 deletions
+4 -19
View File
@@ -59,24 +59,16 @@
<version>1.1.1</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.bugsnag</groupId>
<artifactId>bugsnag</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -90,14 +82,6 @@
<resource>
<directory>deploy</directory>
<filtering>true</filtering>
<excludes>
<exclude>deploy.bat</exclude>
<exclude>package.bat</exclude>
<exclude>clean.bat</exclude>
</excludes>
<!--<includes>-->
<!--<include>deploy.bat</include>-->
<!--</includes>-->
</resource>
</resources>
@@ -139,6 +123,7 @@
<outputDirectory>${project.build.directory}/final/</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
+117 -119
View File
@@ -1,6 +1,5 @@
package org.parabot;
import com.bugsnag.Client;
import org.parabot.core.Configuration;
import org.parabot.core.Core;
import org.parabot.core.Directories;
@@ -11,7 +10,6 @@ import org.parabot.core.network.proxy.ProxyType;
import org.parabot.core.ui.BotUI;
import org.parabot.core.ui.ServerSelector;
import org.parabot.core.ui.utils.UILog;
import org.parabot.environment.api.utils.JavaUtil;
import javax.swing.*;
import java.awt.*;
@@ -27,129 +25,129 @@ import java.net.URI;
* @see <a href="http://www.parabot.org">Homepage</a>
*/
public final class Landing {
private static String username;
private static String password;
public static void main(String... args) throws IOException {
Core.initiateBugsnagInstance();
private static String username;
private static String password;
parseArgs(args);
public static void main(String... args) throws IOException {
Core.verbose("Debug mode: " + Core.inDebugMode());
parseArgs(args);
try {
Core.verbose("Setting look and feel: "
+ UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable t) {
t.printStackTrace();
}
Core.verbose("Debug mode: " + Core.inDebugMode());
if (!Core.inDebugMode() && !Core.isValid() && Core.hasValidation()) {
UILog.log("Updates",
"Please download the newest version of Parabot at "
+ Configuration.DOWNLOAD_BOT,
JOptionPane.INFORMATION_MESSAGE);
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Connection Error",
"Error", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
return;
}
try {
Core.verbose("Setting look and feel: "
+ UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable t) {
t.printStackTrace();
}
Core.verbose("Validating directories...");
Directories.validate();
Core.verbose("Validating account manager...");
AccountManager.validate();
if (!Core.inDebugMode() && !Core.isValid() && Core.hasValidation()) {
UILog.log("Updates",
"Please download the newest version of Parabot at "
+ Configuration.DOWNLOAD_BOT,
JOptionPane.INFORMATION_MESSAGE);
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Connection Error",
"Error", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
return;
}
if (username != null && password != null) {
new BotUI(username, password);
username = null;
password = null;
return;
}
Core.verbose("Validating directories...");
Directories.validate();
Core.verbose("Validating account manager...");
AccountManager.validate();
Core.verbose("Starting login gui...");
new BotUI(null, null);
}
if (username != null && password != null) {
new BotUI(username, password);
username = null;
password = null;
return;
}
private static void parseArgs(String... args) {
for (int i = 0; i < args.length; i++) {
final String arg = args[i].toLowerCase();
switch (arg.toLowerCase()) {
case "-createdirs":
Directories.validate();
System.out
.println("Directories created, you can now run parabot.");
System.exit(0);
break;
case "-debug":
Core.setDebug(true);
break;
case "-v":
case "-verbose":
Core.setVerbose(true);
break;
case "-server":
ServerSelector.initServer = args[++i];
break;
case "-login":
username = args[++i];
password = args[++i];
break;
case "-loadlocal":
Core.setLoadLocal(true);
break;
case "-dump":
Core.setDump(true);
break;
case "-scriptsbin":
Directories.setScriptCompiledDirectory(new File(args[++i]));
break;
case "-serversbin":
Directories.setServerCompiledDirectory(new File(args[++i]));
break;
case "-clearcache":
Directories.clearCache();
break;
case "-mac":
byte[] mac = new byte[6];
String str = args[++i];
if (str.toLowerCase().equals("random")) {
new java.util.Random().nextBytes(mac);
} else {
i--;
for (int j = 0; j < 6; j++) {
mac[j] = Byte.parseByte(args[++i], 16); // parses a hex
// number
}
}
NetworkInterface.setMac(mac);
break;
case "-proxy":
ProxyType type = ProxyType.valueOf(args[++i].toUpperCase());
if (type == null) {
System.err.println("Invalid proxy type:" + args[i]);
System.exit(1);
return;
}
ProxySocket.setProxy(type, args[++i],
Integer.parseInt(args[++i]));
break;
case "-auth":
ProxySocket.auth = true;
ProxySocket.setLogin(args[++i], args[++i]);
break;
case "-no_sec":
Core.disableSec();
break;
case "-no_validation":
Core.disableValidation();
break;
}
}
}
Core.verbose("Starting login gui...");
new BotUI(null, null);
}
private static void parseArgs(String... args) {
for (int i = 0; i < args.length; i++) {
final String arg = args[i].toLowerCase();
switch (arg.toLowerCase()) {
case "-createdirs":
Directories.validate();
System.out
.println("Directories created, you can now run parabot.");
System.exit(0);
break;
case "-debug":
Core.setDebug(true);
break;
case "-v":
case "-verbose":
Core.setVerbose(true);
break;
case "-server":
ServerSelector.initServer = args[++i];
break;
case "-login":
username = args[++i];
password = args[++i];
break;
case "-loadlocal":
Core.setLoadLocal(true);
break;
case "-dump":
Core.setDump(true);
break;
case "-scriptsbin":
Directories.setScriptCompiledDirectory(new File(args[++i]));
break;
case "-serversbin":
Directories.setServerCompiledDirectory(new File(args[++i]));
break;
case "-clearcache":
Directories.clearCache();
break;
case "-mac":
byte[] mac = new byte[6];
String str = args[++i];
if (str.toLowerCase().equals("random")) {
new java.util.Random().nextBytes(mac);
} else {
i--;
for (int j = 0; j < 6; j++) {
mac[j] = Byte.parseByte(args[++i], 16); // parses a hex
// number
}
}
NetworkInterface.setMac(mac);
break;
case "-proxy":
ProxyType type = ProxyType.valueOf(args[++i].toUpperCase());
if (type == null) {
System.err.println("Invalid proxy type:" + args[i]);
System.exit(1);
return;
}
ProxySocket.setProxy(type, args[++i],
Integer.parseInt(args[++i]));
break;
case "-auth":
ProxySocket.auth = true;
ProxySocket.setLogin(args[++i], args[++i]);
break;
case "-no_sec":
Core.disableSec();
break;
case "-no_validation":
Core.disableValidation();
break;
}
}
}
}
-30
View File
@@ -1,8 +1,5 @@
package org.parabot.core;
import com.bugsnag.BeforeNotify;
import com.bugsnag.Client;
import com.bugsnag.Error;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import org.parabot.Landing;
@@ -39,8 +36,6 @@ public class Core {
private static Version currentVersion = Configuration.BOT_VERSION;
private static Version latestVersion;
private static Client bugsnagInstance;
public static void disableValidation() {
Core.validate = false;
}
@@ -286,8 +281,6 @@ public class Core {
Core.verbose("Checking for updates...");
validateCache();
setBugsnagVersion();
if ((validVersion() && checksumValid()) || (!checksumValid() && currentVersion.compareTo(latestVersion) >= 0)){
Core.verbose("No updates available.");
return true;
@@ -297,29 +290,6 @@ public class Core {
}
}
public static void initiateBugsnagInstance() {
bugsnagInstance = new Client(Configuration.BUGSNAG_API);
bugsnagInstance.setSendThreads(true);
}
public static void setBugsnagVersion(){
Core.bugsnagInstance.setReleaseStage(currentVersion != latestVersion ? "development" : "production");
}
public static void setBugsnagUser(String id, String email, String username){
// TODO Check order of parameters
Core.bugsnagInstance.setUser(username, email, id);
}
public static void setBugsnagServer(String server){
Core.setBugsnagInformation("Server", "Server", server);
}
public static void setBugsnagInformation(String tab, String key, String value){
// TODO Should be checked if correct
Core.bugsnagInstance.addToTab(tab, key, value);
}
public static void debug(int i) {
if(mDebug) {
System.out.println("DEBUG: " + i);
@@ -33,8 +33,6 @@ public class Account {
this.username = username;
this.password = password;
this.api = api;
Core.setBugsnagUser("Null", this.username, "Null");
}
/**
@@ -156,7 +156,6 @@ public class Script implements Runnable {
if(state < 0 || state > 2) {
throw new IllegalArgumentException("Illegal state");
}
Core.setBugsnagInformation("Script", "State", String.valueOf(state));
this.state = state;
}
@@ -181,6 +180,5 @@ public class Script implements Runnable {
public void setScriptID(int scriptID){
this.scriptID = scriptID;
Core.setBugsnagInformation("Script", "State", String.valueOf(scriptID));
}
}
@@ -24,8 +24,6 @@ public abstract class ServerExecuter {
@Override
public void run() {
try {
Core.setBugsnagServer(serverName);
Context context = Context.getInstance(provider);
context.load();
PaintComponent.getInstance().startPainting(context);
+1 -1
View File
@@ -1 +1 @@
application.version=${project.version}
application.version=${project.version}${build.version}