Code style fixes

This commit is contained in:
Shadowrs
2018-09-01 20:18:38 +01:00
parent 166eb9dbfb
commit 43cfd1b170
3 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ public final class Landing {
Core.disableValidation(); Core.disableValidation();
break; break;
case "-uuid": case "-uuid":
Core.quickLaunchByUuid = Integer.parseInt(args[++i]); Core.setQuickLaunchByUuid(Integer.parseInt(args[++i]));
break; break;
} }
} }
+10 -2
View File
@@ -28,8 +28,8 @@ import java.security.NoSuchAlgorithmException;
@SuppressWarnings("Duplicates") @SuppressWarnings("Duplicates")
public class Core { public class Core {
public static int quickLaunchByUuid; // 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; // in debug mode, we will print more detailed error messages. private static boolean debug; // in debug mode, we will print more detailed error 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 loadLocal; //Loads both local and public scripts/servers
@@ -47,6 +47,14 @@ public class Core {
return validate; return validate;
} }
public static int getQuickLaunchByUuid() {
return quickLaunchByUuid;
}
public static void setQuickLaunchByUuid(int quickLaunchByUuid) {
Core.quickLaunchByUuid = quickLaunchByUuid;
}
/** /**
* Enabled loadLocal mode * Enabled loadLocal mode
* *
@@ -24,7 +24,7 @@ public class ServerSelector extends JPanel {
public ServerSelector() { public ServerSelector() {
Queue<ServerComponent> widgets = getServers(); Queue<ServerComponent> widgets = getServers();
if (initServer != null || Core.quickLaunchByUuid > 0) { if (initServer != null || Core.getQuickLaunchByUuid() > -1) {
if (runServer(widgets)) { if (runServer(widgets)) {
initServer = null; initServer = null;
return; return;
@@ -76,13 +76,14 @@ public class ServerSelector extends JPanel {
if (widgets == null || widgets.isEmpty()) { if (widgets == null || widgets.isEmpty()) {
return false; return false;
} }
if (Core.quickLaunchByUuid > 0) { // match the pre-requested server config uuid to quick-launch if (Core.getQuickLaunchByUuid() > -1) { // match the pre-requested server config uuid to quick-launch
for (ServerComponent widget : widgets) { for (ServerComponent widget : widgets) {
if (widget.desc.uuid == Core.quickLaunchByUuid) { if (widget.desc.uuid == Core.getQuickLaunchByUuid()) {
Environment.load(widget.desc); Environment.load(widget.desc);
return true; return true;
} }
} }
System.err.println("No server config with -uuid "+Core.getQuickLaunchByUuid()+" was found to quick launch.");
} }
if (initServer != null) { if (initServer != null) {
@@ -93,6 +94,7 @@ public class ServerSelector extends JPanel {
return true; return true;
} }
} }
System.err.println("No server config with -server "+serverName+" was found to quick launch.");
} }
return false; return false;
} }