fixed sonarlint errors and deleted map playerConnectionID
This commit is contained in:
@@ -12,16 +12,15 @@
|
|||||||
public class Game {
|
public class Game {
|
||||||
private int diceModifier = 1;
|
private int diceModifier = 1;
|
||||||
private int diceEyes;
|
private int diceEyes;
|
||||||
private Map<Color, Player> players = new HashMap<Color, Player>();
|
private Map<Color, Player> players = new EnumMap<>(Color.class);
|
||||||
private Statistic gameStatistics;
|
private Statistic gameStatistics;
|
||||||
private ArrayList<BonusCard> drawPile;
|
private List<BonusCard> drawPile;
|
||||||
private ArrayList<BonusCard> discardPile = new ArrayList<>();
|
private List<BonusCard> discardPile = new ArrayList<>();
|
||||||
private Board board;
|
private Board board;
|
||||||
private Color activeColor;
|
private Color activeColor;
|
||||||
private LinkedList<Color> order;
|
private List<Color> order;
|
||||||
private Map<Color, Integer> playerConnectionID;
|
|
||||||
|
|
||||||
private ArrayList<Observer> observers = new ArrayList<>();
|
private final ArrayList<Observer> observers = new ArrayList<>();
|
||||||
private Player startPlayer;
|
private Player startPlayer;
|
||||||
private Boolean gameHasStarted = false;
|
private Boolean gameHasStarted = false;
|
||||||
private Boolean playerHasDisconnected = false;
|
private Boolean playerHasDisconnected = false;
|
||||||
@@ -127,7 +126,7 @@ public void setGameStatistics(Statistic gameStatistics) {
|
|||||||
*
|
*
|
||||||
* @return the draw pile
|
* @return the draw pile
|
||||||
*/
|
*/
|
||||||
public ArrayList<BonusCard> getDrawPile() {
|
public List<BonusCard> getDrawPile() {
|
||||||
return drawPile;
|
return drawPile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +135,7 @@ public ArrayList<BonusCard> getDrawPile() {
|
|||||||
*
|
*
|
||||||
* @param drawPile the new draw pile
|
* @param drawPile the new draw pile
|
||||||
*/
|
*/
|
||||||
public void setDrawPile(ArrayList<BonusCard> drawPile) {
|
public void setDrawPile(List<BonusCard> drawPile) {
|
||||||
this.drawPile = drawPile;
|
this.drawPile = drawPile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +144,7 @@ public void setDrawPile(ArrayList<BonusCard> drawPile) {
|
|||||||
*
|
*
|
||||||
* @return the discard pile
|
* @return the discard pile
|
||||||
*/
|
*/
|
||||||
public ArrayList<BonusCard> getDiscardPile() {
|
public List<BonusCard> getDiscardPile() {
|
||||||
return discardPile;
|
return discardPile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +153,7 @@ public ArrayList<BonusCard> getDiscardPile() {
|
|||||||
*
|
*
|
||||||
* @param discardPile the new discard pile
|
* @param discardPile the new discard pile
|
||||||
*/
|
*/
|
||||||
public void setDiscardPile(ArrayList<BonusCard> discardPile) {
|
public void setDiscardPile(List<BonusCard> discardPile) {
|
||||||
this.discardPile = discardPile;
|
this.discardPile = discardPile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +198,7 @@ public void setActiveColor(Color activeColor) {
|
|||||||
*
|
*
|
||||||
* @return the order of the players
|
* @return the order of the players
|
||||||
*/
|
*/
|
||||||
public LinkedList<Color> getOrder() {
|
public List<Color> getOrder() {
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,48 +207,10 @@ public LinkedList<Color> getOrder() {
|
|||||||
*
|
*
|
||||||
* @param order the new order of the players
|
* @param order the new order of the players
|
||||||
*/
|
*/
|
||||||
public void setOrder(LinkedList<Color> order) {
|
public void setOrder(List<Color> order) {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method returns the player connection ID.
|
|
||||||
*
|
|
||||||
* @return the player connection ID
|
|
||||||
*/
|
|
||||||
public Map<Color, Integer> getPlayerConnectionID() {
|
|
||||||
return playerConnectionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method sets the player connection ID.
|
|
||||||
*
|
|
||||||
* @param playerConnectionID the new player connection ID
|
|
||||||
*/
|
|
||||||
public void setPlayerConnectionID(Map<Color, Integer> playerConnectionID) {
|
|
||||||
this.playerConnectionID = playerConnectionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method sets the player connection ID.
|
|
||||||
*
|
|
||||||
* @param color the color of the player
|
|
||||||
* @param connectionID the new connection ID
|
|
||||||
*/
|
|
||||||
public void setPlayerConnectionID(Color color, int connectionID) {
|
|
||||||
playerConnectionID.put(color, connectionID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method returns the player connection ID.
|
|
||||||
*
|
|
||||||
* @param color the color of the player
|
|
||||||
* @return the player connection ID
|
|
||||||
*/
|
|
||||||
public int getPlayerConnectionID(Color color) {
|
|
||||||
return playerConnectionID.get(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method adds a player to the game.
|
* This method adds a player to the game.
|
||||||
*
|
*
|
||||||
@@ -321,7 +282,7 @@ public Boolean playerHasDisconnected() {
|
|||||||
*/
|
*/
|
||||||
public void setGameIsInterrupted(Boolean gameIsInterrupted) {
|
public void setGameIsInterrupted(Boolean gameIsInterrupted) {
|
||||||
this.gameIsInterrupted = gameIsInterrupted;
|
this.gameIsInterrupted = gameIsInterrupted;
|
||||||
if (!gameIsInterrupted) notifyObservers();
|
if (Boolean.FALSE.equals(gameIsInterrupted)) notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,7 +310,7 @@ public Boolean getMovablePieces() {
|
|||||||
*/
|
*/
|
||||||
public void setMovablePieces(Boolean movablePieces) {
|
public void setMovablePieces(Boolean movablePieces) {
|
||||||
this.movablePieces = movablePieces;
|
this.movablePieces = movablePieces;
|
||||||
if (!movablePieces) notifyObservers();
|
if (Boolean.FALSE.equals(movablePieces)) notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,7 +320,7 @@ public void setMovablePieces(Boolean movablePieces) {
|
|||||||
*/
|
*/
|
||||||
public void setPlayerHasDisconnected(Boolean playerHasDisconnected) {
|
public void setPlayerHasDisconnected(Boolean playerHasDisconnected) {
|
||||||
this.playerHasDisconnected = playerHasDisconnected;
|
this.playerHasDisconnected = playerHasDisconnected;
|
||||||
if (playerHasDisconnected) notifyObservers();
|
if (Boolean.TRUE.equals(playerHasDisconnected)) notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -378,7 +339,7 @@ public Boolean allRanked() {
|
|||||||
*/
|
*/
|
||||||
public void setAllRanked(Boolean allRanked) {
|
public void setAllRanked(Boolean allRanked) {
|
||||||
this.allRanked = allRanked;
|
this.allRanked = allRanked;
|
||||||
if (allRanked) notifyObservers();
|
if (Boolean.TRUE.equals(allRanked)) notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,7 +376,7 @@ public Boolean allReady() {
|
|||||||
*/
|
*/
|
||||||
public void setAllReady(Boolean allReady) {
|
public void setAllReady(Boolean allReady) {
|
||||||
this.allReady = allReady;
|
this.allReady = allReady;
|
||||||
if (allReady) notifyObservers();
|
if (Boolean.TRUE.equals(allReady)) notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user