diff --git a/Projekte/monopoly/client/build.gradle b/Projekte/monopoly/client/build.gradle index 66985e3..683def3 100644 --- a/Projekte/monopoly/client/build.gradle +++ b/Projekte/monopoly/client/build.gradle @@ -10,6 +10,10 @@ dependencies { implementation project(":monopoly:server") implementation libs.jme3.desktop + implementation libs.lemur + implementation libs.lemurproto + + implementation libs.selenium runtimeOnly libs.jme3.awt.dialogs runtimeOnly libs.jme3.plugins 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 d7bbe10..3cbe272 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 @@ -50,6 +50,14 @@ public class PlayerHandler { return players.size(); } + /** + * Retuns all players + * @return List of all players + */ + public List getPlayers() { + return players; + } + /** * Chechs if all players are ready to start the game * @return {@code true} if all players are ready, otherwise {@code false} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java index a65b791..da3ca03 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java @@ -12,6 +12,7 @@ import pp.monopoly.message.client.RollDice; import pp.monopoly.message.client.TradeOffer; import pp.monopoly.message.client.TradeResponse; import pp.monopoly.message.client.ViewAssetsRequest; +import pp.monopoly.message.server.GameStart; import pp.monopoly.message.server.ServerMessage; import pp.monopoly.message.server.TradeReply; import pp.monopoly.message.server.TradeRequest; @@ -180,6 +181,12 @@ public class ServerGameLogic implements ClientInterpreter { playerHandler.setPlayerReady(player, true); LOGGER.log(Level.DEBUG, "Player {0} is ready", player.getName()); } + + if(playerHandler.allPlayersReady()) { + for (Player p : playerHandler.getPlayers()) { + send(p, new GameStart(playerHandler.getPlayers())); + } + } } /** diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java index bf39031..cfdfe54 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/message/server/GameStart.java @@ -1,7 +1,21 @@ package pp.monopoly.message.server; +import java.util.List; + +import pp.monopoly.game.server.Player; + public class GameStart extends ServerMessage{ + private final List players; + + public GameStart(List players) { + this.players = players; + } + + public List getPlayers() { + return players; + } + @Override public void accept(ServerInterpreter interpreter) { interpreter.received(this); diff --git a/Projekte/settings.gradle b/Projekte/settings.gradle index 92a7ec5..928fed6 100644 --- a/Projekte/settings.gradle +++ b/Projekte/settings.gradle @@ -25,7 +25,9 @@ dependencyResolutionManagement { library('jme3-effects', 'org.jmonkeyengine', 'jme3-effects').versionRef('jme') library('lemur', 'com.simsilica:lemur:1.16.0') - library('lemur-proto', 'com.simsilica:lemur-proto:1.13.0') + library('lemurproto', 'com.simsilica:lemur-proto:1.13.0') + + library('selenium', 'org.seleniumhq.selenium:selenium-java:4.11.0') library('junit4', 'junit:junit:4.13.2') library('gson', 'com.google.code.gson:gson:2.11.0')