From bcaf8640d4fc1a24bb049829a4855cb93ac9e337 Mon Sep 17 00:00:00 2001 From: Kristian Knarvik Date: Sun, 28 Jan 2018 16:23:15 +0100 Subject: [PATCH] Minor fixes --- src/net/knarcraft/serverlauncher/server/Server.java | 9 +++++---- test/ServerTest.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/net/knarcraft/serverlauncher/server/Server.java b/src/net/knarcraft/serverlauncher/server/Server.java index b0df2b2..490e60c 100644 --- a/src/net/knarcraft/serverlauncher/server/Server.java +++ b/src/net/knarcraft/serverlauncher/server/Server.java @@ -4,7 +4,6 @@ import net.knarcraft.serverlauncher.userinterface.GUI; import java.io.*; import java.net.URL; -import java.nio.Buffer; import java.util.Scanner; import java.nio.file.*; import java.util.ArrayList; @@ -97,7 +96,7 @@ public class Server { public static void stop() throws IOException { for (Server server : servers) { if (server.writer != null) { - if (server.type.getName() == "Bungee") { + if (server.type.getName().equals("Bungee")) { server.writer.write("end\n"); } else { server.writer.write("stop\n"); @@ -134,7 +133,9 @@ public class Server { public static void startServers() { System.out.println("Starting servers."); for (Server server : servers) { - server.run(); + if (!server.run()) { + gui.setStatus("An error occurred. Start aborted"); + } } } @@ -148,7 +149,7 @@ public class Server { this.downloadJar(); gui.setStatus("File downloaded"); } catch (FileNotFoundException e) { - System.out.println("File was not found"); + gui.setStatus("Error: Jar file not found"); return false; } try { diff --git a/test/ServerTest.java b/test/ServerTest.java index 00a4188..5fde4e3 100644 --- a/test/ServerTest.java +++ b/test/ServerTest.java @@ -14,7 +14,7 @@ import java.io.*; * @since 0.0.0.1 */ class ServerTest { - public static void main(String[] args) throws IOException { + public static void main(String[] args) { EventQueue.invokeLater(() -> { try { setup();