This commit is contained in:
Luca Puderbach 2024-11-20 02:39:20 +01:00
commit 1203077aed
5 changed files with 36 additions and 1 deletions

View File

@ -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

View File

@ -50,6 +50,14 @@ public class PlayerHandler {
return players.size();
}
/**
* Retuns all players
* @return List of all players
*/
public List<Player> getPlayers() {
return players;
}
/**
* Chechs if all players are ready to start the game
* @return {@code true} if all players are ready, otherwise {@code false}

View File

@ -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()));
}
}
}
/**

View File

@ -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<Player> players;
public GameStart(List<Player> players) {
this.players = players;
}
public List<Player> getPlayers() {
return players;
}
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);

View File

@ -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')