summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/Player.java8
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java4
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/effects/InstantOwnBoardEffect.java2
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java1
-rw-r--r--src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java2
5 files changed, 7 insertions, 10 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/Player.java b/src/main/java/org/luxons/sevenwonders/game/Player.java
index 3e25cb80..c8c1509c 100644
--- a/src/main/java/org/luxons/sevenwonders/game/Player.java
+++ b/src/main/java/org/luxons/sevenwonders/game/Player.java
@@ -14,13 +14,9 @@ public class Player {
private transient Game game;
- public Player(String userName) {
+ public Player(String userName, String displayName) {
this.userName = userName;
- }
-
- public Player(String displayName, String userName) {
- this(userName);
- setDisplayName(displayName);
+ this.displayName = displayName;
}
public String getUserName() {
diff --git a/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java b/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java
index 8f50db29..c1a51f24 100644
--- a/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java
+++ b/src/main/java/org/luxons/sevenwonders/game/data/serializers/NumericEffectSerializer.java
@@ -19,7 +19,7 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese
@Override
public JsonElement serialize(Effect effect, Type typeOfSrc, JsonSerializationContext context) {
- int value = 0;
+ int value;
if (MilitaryReinforcements.class.equals(typeOfSrc)) {
value = ((MilitaryReinforcements)effect).getCount();
} else if (GoldIncrease.class.equals(typeOfSrc)) {
@@ -27,7 +27,7 @@ public class NumericEffectSerializer implements JsonSerializer<Effect>, JsonDese
} else if (RawPointsIncrease.class.equals(typeOfSrc)) {
value = ((RawPointsIncrease)effect).getPoints();
} else {
- throw new IllegalArgumentException("Unknown numeric effet " + typeOfSrc.getTypeName());
+ throw new IllegalArgumentException("Unknown numeric effect " + typeOfSrc.getTypeName());
}
return new JsonPrimitive(value);
}
diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/InstantOwnBoardEffect.java b/src/main/java/org/luxons/sevenwonders/game/effects/InstantOwnBoardEffect.java
index 79216c93..8f4340cf 100644
--- a/src/main/java/org/luxons/sevenwonders/game/effects/InstantOwnBoardEffect.java
+++ b/src/main/java/org/luxons/sevenwonders/game/effects/InstantOwnBoardEffect.java
@@ -10,7 +10,7 @@ public abstract class InstantOwnBoardEffect implements Effect {
apply(table.getBoard(playerIndex));
}
- public abstract void apply(Board board);
+ protected abstract void apply(Board board);
@Override
public int computePoints(Table table, int playerIndex) {
diff --git a/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java b/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java
index ff2a59c7..9724dfcd 100644
--- a/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java
+++ b/src/main/java/org/luxons/sevenwonders/game/effects/ProductionIncrease.java
@@ -17,6 +17,7 @@ public class ProductionIncrease extends InstantOwnBoardEffect {
this.production = production;
}
+ @Override
public void apply(Board board) {
board.getProduction().addAll(production);
}
diff --git a/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java b/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java
index e671088f..cd63c440 100644
--- a/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java
+++ b/src/main/java/org/luxons/sevenwonders/repositories/PlayerRepository.java
@@ -21,7 +21,7 @@ public class PlayerRepository {
}
private Player createPlayer(String userName, String displayName) {
- Player player = new Player(displayName, userName);
+ Player player = new Player(userName, displayName);
add(player);
return player;
}
bgstack15