From ab26b33d99b2d3b6fc19d3d8284fe71cdfe905e6 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Mon, 31 Aug 2020 22:25:33 +0200 Subject: [PATCH] Launcher: Server list: reset color of labels probably --- .../de/bixilon/minosoft/gui/main/ServerListCell.java | 11 ++++++----- .../de/bixilon/minosoft/protocol/network/Network.java | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/gui/main/ServerListCell.java b/src/main/java/de/bixilon/minosoft/gui/main/ServerListCell.java index 6ad6e0c74..6b3469f50 100644 --- a/src/main/java/de/bixilon/minosoft/gui/main/ServerListCell.java +++ b/src/main/java/de/bixilon/minosoft/gui/main/ServerListCell.java @@ -107,9 +107,9 @@ public class ServerListCell extends ListCell implements Initializable { // clear all cells motd.setText(""); - motd.setTextFill(Color.BLACK); + motd.setStyle(null); version.setText("Connecting..."); - version.setTextFill(Color.BLACK); + version.setStyle(null); players.setText(""); optionsConnect.setOnAction(e -> connect()); optionsConnect.setDisable(true); @@ -143,8 +143,9 @@ public class ServerListCell extends ListCell implements Initializable { // Offline players.setText(""); version.setText("Offline"); + version.setStyle("-fx-text-fill: red;"); motd.setText(String.format("%s", server.getLastPing().getLastConnectionException())); - motd.setTextFill(Color.RED); + motd.setStyle("-fx-text-fill: red;"); optionsConnect.setDisable(true); canConnect = false; return; @@ -155,11 +156,11 @@ public class ServerListCell extends ListCell implements Initializable { serverVersion = Versions.getVersionById(ping.getProtocolNumber()); } else { serverVersion = Versions.getVersionById(server.getDesiredVersion()); - version.setTextFill(Color.GREEN); + version.setStyle("-fx-text-fill: green;"); } if (serverVersion == null) { version.setText(ping.getServerVersion()); - version.setTextFill(Color.RED); + version.setStyle("-fx-text-fill: red;"); optionsConnect.setDisable(true); canConnect = false; } else { diff --git a/src/main/java/de/bixilon/minosoft/protocol/network/Network.java b/src/main/java/de/bixilon/minosoft/protocol/network/Network.java index ecb546d16..d078f61cd 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/network/Network.java +++ b/src/main/java/de/bixilon/minosoft/protocol/network/Network.java @@ -31,7 +31,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; -import java.net.*; +import java.net.InetSocketAddress; +import java.net.Socket; import java.util.LinkedList; public class Network { @@ -206,9 +207,7 @@ public class Network { } catch (IOException e) { // Could not connect lastException = e; - if (e instanceof SocketTimeoutException || e instanceof ConnectException || e instanceof UnknownHostException) { - connection.setConnectionState(ConnectionStates.FAILED); - } + connection.setConnectionState(ConnectionStates.FAILED); e.printStackTrace(); } });