Fikser en feil i serveren som hindret en spiller som ikke hadde sendt inn navnet sitt fra å koble fra

This commit is contained in:
Kristian Knarvik 2020-04-28 12:10:00 +02:00
parent 224851ce2c
commit 3924189839
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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);