fix: fixed equals in Lobby

This commit is contained in:
Yannik Bretschneider 2021-06-06 17:44:28 +02:00
parent 0c8dd3f1a8
commit e689248f9e
1 changed files with 3 additions and 3 deletions

View File

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