From c7c2d95aeda373812653cc46622840d95b236ebd Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 18 Nov 2024 05:00:31 +0100 Subject: [PATCH] refactor for java 20 --- .../monopoly/game/server/PlayerHandler.java | 6 +- .../monopoly/model/fields/BoardManager.java | 80 +++++++++---------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java index a5cc850..d7bbe10 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java @@ -109,8 +109,10 @@ public class PlayerHandler { * @return the next players who is active */ Player nextPlayer() { - players.addLast(players.removeFirst()); - return players.getFirst(); + Player tmp = players.get(0); + players.remove(0); + players.add(tmp); + return players.get(0); } /** diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java index cf0b74d..0cb7c0c 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java @@ -25,46 +25,46 @@ public class BoardManager { private static List createBoard() { ArrayList fields = new ArrayList<>(); - fields.addLast(new GoField()); - fields.addLast(new BuildingProperty("Gym", 1, 600, 20)); - fields.addLast(new EventField("Hausfeier", 2)); - fields.addLast(new BuildingProperty("Sportplatz", 3, 600, 40)); - fields.addLast(new FineField("Diszi", 4, 2000)); - fields.addLast(new GateField("Südtor", 5)); - fields.addLast(new BuildingProperty("Studium+", 6, 1000, 60)); - fields.addLast(new EventField("Üvas", 7)); - fields.addLast(new BuildingProperty("PhysikHörsaal", 8, 1000, 60)); - fields.addLast(new BuildingProperty("Audimax", 9, 1200, 80)); - fields.addLast(new GulagField()); - fields.addLast(new BuildingProperty("99er", 11, 1400, 100)); - fields.addLast(new FoodField("Brandl", 12)); - fields.addLast(new BuildingProperty("12er", 13, 1400, 100)); - fields.addLast(new BuildingProperty("23er", 14, 1600, 120)); - fields.addLast(new GateField("HauptWache", 15)); - fields.addLast(new BuildingProperty("Schwimmhalle", 16, 1800, 140)); - fields.addLast(new BuildingProperty("CISM-Bahn", 17, 1800, 140)); - fields.addLast(new EventField("Marine-Welcome-Party", 18)); - fields.addLast(new BuildingProperty("Kletterturm", 19, 2000, 160)); - fields.addLast(new TestStreckeField()); - fields.addLast(new BuildingProperty("StudFBer C", 21, 2200, 180)); - fields.addLast(new EventField("Üvas", 22)); - fields.addLast(new BuildingProperty("StudFBer B", 23, 2200, 180)); - fields.addLast(new BuildingProperty("StudFBer A", 24, 2400, 200)); - fields.addLast(new GateField("Nordtor", 25)); - fields.addLast(new BuildingProperty("Cascada", 26, 2600, 220)); - fields.addLast(new BuildingProperty("Fakultätsgebäude", 27, 2600, 220)); - fields.addLast(new FoodField("Truppenküche", 28)); - fields.addLast(new BuildingProperty("Prüfungsamt", 29, 2800, 240)); - fields.addLast(new WacheField()); - fields.addLast(new BuildingProperty("Feuerwehr", 31, 3000, 260)); - fields.addLast(new BuildingProperty("SanZ", 32, 300, 260)); - fields.addLast(new EventField("Maibock", 33)); - fields.addLast(new BuildingProperty("Rechenzentrum", 34, 3200, 280)); - fields.addLast(new GateField("Osttor", 35)); - fields.addLast(new EventField("Üvas", 36)); - fields.addLast(new BuildingProperty("2er", 37, 3500, 350)); - fields.addLast(new FineField("EZM", 38, 1000)); - fields.addLast(new BuildingProperty("20er", 39, 4000, 500)); + fields.add(new GoField()); + fields.add(new BuildingProperty("Gym", 1, 600, 20)); + fields.add(new EventField("Hausfeier", 2)); + fields.add(new BuildingProperty("Sportplatz", 3, 600, 40)); + fields.add(new FineField("Diszi", 4, 2000)); + fields.add(new GateField("Südtor", 5)); + fields.add(new BuildingProperty("Studium+", 6, 1000, 60)); + fields.add(new EventField("Üvas", 7)); + fields.add(new BuildingProperty("PhysikHörsaal", 8, 1000, 60)); + fields.add(new BuildingProperty("Audimax", 9, 1200, 80)); + fields.add(new GulagField()); + fields.add(new BuildingProperty("99er", 11, 1400, 100)); + fields.add(new FoodField("Brandl", 12)); + fields.add(new BuildingProperty("12er", 13, 1400, 100)); + fields.add(new BuildingProperty("23er", 14, 1600, 120)); + fields.add(new GateField("HauptWache", 15)); + fields.add(new BuildingProperty("Schwimmhalle", 16, 1800, 140)); + fields.add(new BuildingProperty("CISM-Bahn", 17, 1800, 140)); + fields.add(new EventField("Marine-Welcome-Party", 18)); + fields.add(new BuildingProperty("Kletterturm", 19, 2000, 160)); + fields.add(new TestStreckeField()); + fields.add(new BuildingProperty("StudFBer C", 21, 2200, 180)); + fields.add(new EventField("Üvas", 22)); + fields.add(new BuildingProperty("StudFBer B", 23, 2200, 180)); + fields.add(new BuildingProperty("StudFBer A", 24, 2400, 200)); + fields.add(new GateField("Nordtor", 25)); + fields.add(new BuildingProperty("Cascada", 26, 2600, 220)); + fields.add(new BuildingProperty("Fakultätsgebäude", 27, 2600, 220)); + fields.add(new FoodField("Truppenküche", 28)); + fields.add(new BuildingProperty("Prüfungsamt", 29, 2800, 240)); + fields.add(new WacheField()); + fields.add(new BuildingProperty("Feuerwehr", 31, 3000, 260)); + fields.add(new BuildingProperty("SanZ", 32, 300, 260)); + fields.add(new EventField("Maibock", 33)); + fields.add(new BuildingProperty("Rechenzentrum", 34, 3200, 280)); + fields.add(new GateField("Osttor", 35)); + fields.add(new EventField("Üvas", 36)); + fields.add(new BuildingProperty("2er", 37, 3500, 350)); + fields.add(new FineField("EZM", 38, 1000)); + fields.add(new BuildingProperty("20er", 39, 4000, 500)); return fields; }