From e689248f9e46a8d102d12484a4a5da8ecae4655d Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Sun, 6 Jun 2021 17:44:28 +0200 Subject: [PATCH] fix: fixed equals in Lobby --- .../java/uulm/teamname/marvelous/server/lobby/Lobby.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java index 9a5c7f6..4aa383e 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobby/Lobby.java @@ -217,25 +217,25 @@ public class Lobby { return activePlayer; } + // Note: DO NOT ADD the connection to the equals and hashcode here, otherwise they recursively call each other @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Lobby lobby = (Lobby) o; - return badRequests == lobby.badRequests && Objects.equals(gameID, lobby.gameID) && Objects.equals(connection, lobby.connection) && Objects.equals(game, lobby.game) && Objects.equals(pipeline, lobby.pipeline) && Objects.equals(activePlayer, lobby.activePlayer) && Objects.equals(pauseSegment, lobby.pauseSegment) && Objects.equals(turnTimer, lobby.turnTimer); + return badRequests == lobby.badRequests && Objects.equals(gameID, lobby.gameID) && Objects.equals(game, lobby.game) && Objects.equals(pipeline, lobby.pipeline) && Objects.equals(activePlayer, lobby.activePlayer) && Objects.equals(pauseSegment, lobby.pauseSegment) && Objects.equals(turnTimer, lobby.turnTimer); } @Override public int hashCode() { - return Objects.hash(gameID, connection, game, pipeline, activePlayer, badRequests, pauseSegment, turnTimer); + return Objects.hash(gameID, game, pipeline, activePlayer, badRequests, pauseSegment, turnTimer); } @Override public String toString() { return "Lobby{" + "gameID='" + gameID + '\'' + - ", connection=" + connection + ", game=" + game + ", pipeline=" + pipeline + ", activePlayer=" + activePlayer +