mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-02 16:49:10 +00:00
Remove Server UUID Stuff
This commit is contained in:
@@ -75,7 +75,7 @@ public final class Landing {
|
|||||||
case "-mac":
|
case "-mac":
|
||||||
byte[] mac = new byte[6];
|
byte[] mac = new byte[6];
|
||||||
String str = args[++i];
|
String str = args[++i];
|
||||||
if (str.toLowerCase().equals("random")) {
|
if (str.equalsIgnoreCase("random")) {
|
||||||
new java.util.Random().nextBytes(mac);
|
new java.util.Random().nextBytes(mac);
|
||||||
} else {
|
} else {
|
||||||
i--;
|
i--;
|
||||||
@@ -98,11 +98,8 @@ public final class Landing {
|
|||||||
case "-no_sec":
|
case "-no_sec":
|
||||||
Core.disableSec();
|
Core.disableSec();
|
||||||
break;
|
break;
|
||||||
case "-uuid":
|
|
||||||
Core.setQuickLaunchByUuid(Integer.parseInt(args[++i]));
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
System.err.println(String.format("Unknown argument given: %s", arg.toLowerCase()));
|
System.err.printf("Unknown argument given: %s%n", arg.toLowerCase());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,6 @@
|
|||||||
package org.parabot.core;
|
package org.parabot.core;
|
||||||
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
import org.parabot.Landing;
|
|
||||||
import org.parabot.core.ui.utils.UILog;
|
import org.parabot.core.ui.utils.UILog;
|
||||||
import org.parabot.environment.api.utils.Version;
|
|
||||||
import org.parabot.environment.api.utils.WebUtil;
|
|
||||||
|
|
||||||
import java.awt.Desktop;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The core of parabot
|
* The core of parabot
|
||||||
@@ -27,23 +9,12 @@ import javax.swing.JOptionPane;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
public class Core {
|
public class Core {
|
||||||
private static int quickLaunchByUuid = -1; // used like -server, but denoted by an Int rather than the server name
|
|
||||||
private static boolean verbose;
|
private static boolean verbose;
|
||||||
private static boolean dump;
|
private static boolean dump;
|
||||||
private static boolean secure = true;
|
private static boolean secure = true;
|
||||||
|
|
||||||
public static int getQuickLaunchByUuid() {
|
|
||||||
return quickLaunchByUuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setQuickLaunchByUuid(int quickLaunchByUuid) {
|
|
||||||
Core.quickLaunchByUuid = quickLaunchByUuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables dump mode
|
* Enables dump mode
|
||||||
*
|
|
||||||
* @param dump
|
|
||||||
*/
|
*/
|
||||||
public static void setDump(final boolean dump) {
|
public static void setDump(final boolean dump) {
|
||||||
Core.dump = dump;
|
Core.dump = dump;
|
||||||
@@ -95,8 +66,6 @@ public class Core {
|
|||||||
/**
|
/**
|
||||||
* Prints a debug line to the Logger and System PrintStream
|
* Prints a debug line to the Logger and System PrintStream
|
||||||
* Meant for the debug adapter within hooks
|
* Meant for the debug adapter within hooks
|
||||||
*
|
|
||||||
* @param line
|
|
||||||
*/
|
*/
|
||||||
public static void debug(final String line) {
|
public static void debug(final String line) {
|
||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
package org.parabot.core.ui;
|
package org.parabot.core.ui;
|
||||||
|
|
||||||
import org.parabot.Configuration;
|
import org.parabot.Configuration;
|
||||||
import org.parabot.core.Core;
|
|
||||||
import org.parabot.core.desc.ServerDescription;
|
import org.parabot.core.desc.ServerDescription;
|
||||||
import org.parabot.core.parsers.ServerParser;
|
import org.parabot.core.parsers.ServerParser;
|
||||||
import org.parabot.core.ui.components.ServerComponent;
|
import org.parabot.core.ui.components.ServerComponent;
|
||||||
import org.parabot.environment.Environment;
|
import org.parabot.environment.Environment;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import javax.swing.*;
|
||||||
import java.awt.Dimension;
|
import java.awt.*;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a list of every supported server which can be started
|
* Shows a list of every supported server which can be started
|
||||||
*
|
*
|
||||||
@@ -28,7 +24,7 @@ public class ServerSelector extends JPanel {
|
|||||||
|
|
||||||
public ServerSelector() {
|
public ServerSelector() {
|
||||||
Queue<ServerComponent> widgets = getServers();
|
Queue<ServerComponent> widgets = getServers();
|
||||||
if (initServer != null || Core.getQuickLaunchByUuid() > -1) {
|
if (initServer != null) {
|
||||||
if (runServer(widgets)) {
|
if (runServer(widgets)) {
|
||||||
initServer = null;
|
initServer = null;
|
||||||
return;
|
return;
|
||||||
@@ -81,32 +77,19 @@ public class ServerSelector extends JPanel {
|
|||||||
public Queue<ServerComponent> getServers() {
|
public Queue<ServerComponent> getServers() {
|
||||||
final Queue<ServerComponent> widgets = new LinkedList<>();
|
final Queue<ServerComponent> widgets = new LinkedList<>();
|
||||||
ServerDescription[] servers = ServerParser.getDescriptions();
|
ServerDescription[] servers = ServerParser.getDescriptions();
|
||||||
if (servers != null) {
|
for (ServerDescription desc : servers) {
|
||||||
for (ServerDescription desc : servers) {
|
widgets.add(new ServerComponent(desc));
|
||||||
widgets.add(new ServerComponent(desc));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return widgets;
|
return widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called when -server argument is given, or -uuid arg is given.
|
* This method is called when -server argument is given, or -uuid arg is given.
|
||||||
*
|
|
||||||
* @param widgets
|
|
||||||
*/
|
*/
|
||||||
private boolean runServer(Queue<ServerComponent> widgets) {
|
private boolean runServer(Queue<ServerComponent> widgets) {
|
||||||
if (widgets == null || widgets.isEmpty()) {
|
if (widgets == null || widgets.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Core.getQuickLaunchByUuid() > -1) { // match the pre-requested server config uuid to quick-launch
|
|
||||||
for (ServerComponent widget : widgets) {
|
|
||||||
if (widget.desc.uuid == Core.getQuickLaunchByUuid()) {
|
|
||||||
Environment.load(widget.desc);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.err.println("No server config with -uuid " + Core.getQuickLaunchByUuid() + " was found to quick launch.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initServer != null) {
|
if (initServer != null) {
|
||||||
final String serverName = initServer.toLowerCase(); // match the pre-requested server name to quick-launch
|
final String serverName = initServer.toLowerCase(); // match the pre-requested server name to quick-launch
|
||||||
|
|||||||
Reference in New Issue
Block a user