diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-02 19:09:52 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-05 00:07:30 +0100 |
commit | f3866e8b99b2bc8956763f9bd7884d7e5311aaf0 (patch) | |
tree | 069ca69f2fa6ff20aa634ba3453ea5f7ff96a6d3 /src/main/java | |
parent | Remove move-specific code from Table (diff) | |
download | seven-wonders-f3866e8b99b2bc8956763f9bd7884d7e5311aaf0.tar.gz seven-wonders-f3866e8b99b2bc8956763f9bd7884d7e5311aaf0.tar.bz2 seven-wonders-f3866e8b99b2bc8956763f9bd7884d7e5311aaf0.zip |
Code cleaning
Diffstat (limited to 'src/main/java')
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; } |