Cleanup & Remove Some Uneeded Args(-server/-login/-loadlocal)

This commit is contained in:
Dark98
2021-10-06 16:11:35 +01:00
parent cadd8847ef
commit 69f21ce386
3 changed files with 6 additions and 69 deletions
+4 -33
View File
@@ -21,8 +21,6 @@ import javax.swing.UIManager;
* @see <a href="https://www.parabot.org">Homepage</a> * @see <a href="https://www.parabot.org">Homepage</a>
*/ */
public final class Landing { public final class Landing {
private static String username;
private static String password;
public static void main(String... args) { public static void main(String... args) {
// Thread.setDefaultUncaughtExceptionHandler(new FileExceptionHandler(ExceptionHandler.ExceptionType.CLIENT)); // Thread.setDefaultUncaughtExceptionHandler(new FileExceptionHandler(ExceptionHandler.ExceptionType.CLIENT));
@@ -40,8 +38,6 @@ public final class Landing {
Directories.validate(); Directories.validate();
Core.verbose("Debug mode: " + Core.inDebugMode());
try { try {
Core.verbose("Setting look and feel: " Core.verbose("Setting look and feel: "
+ UIManager.getSystemLookAndFeelClassName()); + UIManager.getSystemLookAndFeelClassName());
@@ -50,27 +46,16 @@ public final class Landing {
t.printStackTrace(); t.printStackTrace();
} }
if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) { if (Core.hasValidation() && !Core.isValid()) {
if (Core.newVersionAlert() == JOptionPane.YES_OPTION) { if (Core.newVersionAlert() == JOptionPane.YES_OPTION) {
Core.downloadNewVersion(); Core.downloadNewVersion();
return; return;
} }
} }
Core.verbose("Validating account manager..."); Core.verbose("Starting 2006Scape...");
if (username != null && password != null) {
new BotUI(username, password);
username = null;
password = null;
return;
}
Core.verbose("Starting login gui...");
Core.setDebug(true); //offline mode
Directories.clearCache(); //clear cache
ServerSelector.initServer = "2006Scape"; ServerSelector.initServer = "2006Scape";
new BotUI(null, null); new BotUI();
} }
private static void parseArgs(String... args) { private static void parseArgs(String... args) {
@@ -82,28 +67,14 @@ public final class Landing {
System.out.println("Directories created, you can now run parabot."); System.out.println("Directories created, you can now run parabot.");
System.exit(0); System.exit(0);
break; break;
case "-dump":
case "-debug": case "-debug":
Core.setDump(true); Core.setDump(true);
case "-offlinemode":
Core.setDebug(true);
break; break;
case "-v": case "-v":
case "-verbose": case "-verbose":
Core.setVerbose(true); Core.setVerbose(true);
break; 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": case "-scriptsbin":
Directories.setScriptCompiledDirectory(new File(args[++i])); Directories.setScriptCompiledDirectory(new File(args[++i]));
break; break;
-34
View File
@@ -30,10 +30,8 @@ public class Core {
private static final Version currentVersion = Configuration.BOT_VERSION; private static final Version currentVersion = Configuration.BOT_VERSION;
private static int quickLaunchByUuid = -1; // used like -server, but denoted by an Int rather than the server name private static int quickLaunchByUuid = -1; // used like -server, but denoted by an Int rather than the server name
private static boolean debug; // Debug mode is Offline Mode. No BDN connection for Servers/Scripts/User Login. Not related to debug messages.
private static boolean verbose; private static boolean verbose;
private static boolean dump; private static boolean dump;
private static boolean loadLocal; //Loads both local and public scripts/servers
private static boolean validate = true; private static boolean validate = true;
private static boolean secure = true; private static boolean secure = true;
@@ -53,31 +51,6 @@ public class Core {
Core.quickLaunchByUuid = quickLaunchByUuid; Core.quickLaunchByUuid = quickLaunchByUuid;
} }
/**
* Enabled loadLocal mode
*
* @param loadLocal
*/
public static void setLoadLocal(final boolean loadLocal) {
Core.loadLocal = loadLocal;
}
/**
* @return if the client is in loadLocal mode.
*/
public static boolean inLoadLocal() {
return loadLocal;
}
/**
* Set debug mode AKA Offline Mode. If true, BDN login will be skipped, so BDN Servers or Scripts will be unavailable.
*
* @param debug
*/
public static void setDebug(final boolean debug) {
Core.debug = debug;
}
/** /**
* Enables dump mode * Enables dump mode
* *
@@ -101,13 +74,6 @@ public class Core {
return secure; return secure;
} }
/**
* @return if the client is in debug mode AKA Offline Mode. BDN Servers and Scripts are unavailable.
*/
public static boolean inDebugMode() {
return debug;
}
/** /**
* @return if the client is in verbose mode. * @return if the client is in verbose mode.
*/ */
+2 -2
View File
@@ -56,7 +56,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
private JMenuItem run, pause, stop, cacheClear, notifications; private JMenuItem run, pause, stop, cacheClear, notifications;
private boolean runScript, pauseScript; private boolean runScript, pauseScript;
public BotUI(String username, String password) { public BotUI() {
if (instance != null) { if (instance != null) {
throw new IllegalStateException("BotUI already created"); throw new IllegalStateException("BotUI already created");
} }
@@ -73,7 +73,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
addWindowListener(this); addWindowListener(this);
add(GamePanel.getInstance()); add(GamePanel.getInstance());
GamePanel.getInstance().add(VerboseLoader.get(username, password), BorderLayout.CENTER); GamePanel.getInstance().add(VerboseLoader.get(), BorderLayout.CENTER);
add(Logger.getInstance(), BorderLayout.SOUTH); add(Logger.getInstance(), BorderLayout.SOUTH);
SwingUtil.setParabotIcons(this); SwingUtil.setParabotIcons(this);