refactor: changed public final variables to getters

This commit is contained in:
Yannik Bretschneider 2021-06-05 19:44:09 +02:00
parent f55168e23f
commit f8428fea3e
2 changed files with 29 additions and 9 deletions

View File

@ -18,10 +18,10 @@ import uulm.teamname.marvelous.server.lobbymanager.Participant;
import java.util.*;
public class Lobby {
public final String gameID;
public final LobbyConnection connection;
public final GameInstance game;
public final Pipeline pipeline;
private final String gameID;
private final LobbyConnection connection;
private final GameInstance game;
private final Pipeline pipeline;
private Participant activePlayer;
private int badRequests;
private PauseSegment pauseSegment;
@ -176,4 +176,24 @@ public class Lobby {
public PauseSegment getPauseSegment() {
return pauseSegment;
}
public String getGameID() {
return gameID;
}
public LobbyConnection getConnection() {
return connection;
}
public GameInstance getGame() {
return game;
}
public Pipeline getPipeline() {
return pipeline;
}
public Participant getActivePlayer() {
return activePlayer;
}
}

View File

@ -23,14 +23,14 @@ public class DisconnectSegment implements Segment {
Logger.trace("DisconnectSegment received {} requests.", packet.size());
if (packet.containsRequestOfType(RequestType.DisconnectRequest)) {
Logger.debug("Player of Type {} sent DisconnectRequest", packet.getOrigin().type);
parent.connection.removePlayer(packet.getOrigin());
parent.getConnection().removePlayer(packet.getOrigin());
if (packet.getOrigin().type != ParticipantType.Spectator) {
if(parent.connection.hasPlayer1()){
parent.generateWin(parent.connection.getPlayer1());
if(parent.getConnection().hasPlayer1()){
parent.generateWin(parent.getConnection().getPlayer1());
}
else if(parent.connection.hasPlayer2()) {
parent.generateWin(parent.connection.getPlayer2());
else if(parent.getConnection().hasPlayer2()) {
parent.generateWin(parent.getConnection().getPlayer2());
}
}
packet.clear();