From 3924189839e64e741cc16ad9c9bd1de608057ef3 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 28 Apr 2020 12:10:00 +0200 Subject: [PATCH] =?UTF-8?q?Fikser=20en=20feil=20i=20serveren=20som=20hindr?= =?UTF-8?q?et=20en=20spiller=20som=20ikke=20hadde=20sendt=20inn=20navnet?= =?UTF-8?q?=20sitt=20fra=20=C3=A5=20koble=20fra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fiasko/roborally/gamewrapper/screens/StartMenuScreen.java | 2 +- .../inf112/fiasko/roborally/networking/RoboRallyClient.java | 4 ++-- .../fiasko/roborally/networking/RoboRallyServerListener.java | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/StartMenuScreen.java b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/StartMenuScreen.java index ecf0586..217ce66 100644 --- a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/StartMenuScreen.java +++ b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/StartMenuScreen.java @@ -19,7 +19,7 @@ import java.io.IOException; */ public class StartMenuScreen extends AbstractScreen { private final RoboRallyWrapper roboRallyWrapper; - private TextField textInput; + private final TextField textInput; /** * Instantiates a new start menu screen diff --git a/src/main/java/inf112/fiasko/roborally/networking/RoboRallyClient.java b/src/main/java/inf112/fiasko/roborally/networking/RoboRallyClient.java index 2d1d401..c82898c 100644 --- a/src/main/java/inf112/fiasko/roborally/networking/RoboRallyClient.java +++ b/src/main/java/inf112/fiasko/roborally/networking/RoboRallyClient.java @@ -31,8 +31,8 @@ public class RoboRallyClient { /** * Connects to a Robo Rally server * - * @param ipAddress The ip address of the server to join - * @param serverPort The port the server is hosted on + * @param ipAddress The ip address of the server to join + * @param serverPort The port the server is hosted on * @throws IOException If the server cannot be connected to */ public void connect(String ipAddress, int serverPort) throws IOException { diff --git a/src/main/java/inf112/fiasko/roborally/networking/RoboRallyServerListener.java b/src/main/java/inf112/fiasko/roborally/networking/RoboRallyServerListener.java index c38cab9..0b989d5 100644 --- a/src/main/java/inf112/fiasko/roborally/networking/RoboRallyServerListener.java +++ b/src/main/java/inf112/fiasko/roborally/networking/RoboRallyServerListener.java @@ -209,7 +209,8 @@ class RoboRallyServerListener extends Listener { @Override public void disconnected(Connection connection) { - if (deadPlayers.contains(connection) || !clients.keySet().contains(connection)) { + if (deadPlayers.contains(connection) || !clients.containsKey(connection) || + !playerNames.containsKey(connection)) { //Remove all traces of the player ever existing clients.remove(connection); playerNames.remove(connection);