diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java index 6e220b2..920b8fe 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java @@ -494,6 +494,7 @@ public class Player implements FieldVisitor{ */ private static int rollDice() { return random.nextInt(6) + 1; + // return 3; } } 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 f09feb0..6156ba2 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 @@ -20,6 +20,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.GameOver; import pp.monopoly.message.server.GameStart; import pp.monopoly.message.server.NextPlayerTurn; import pp.monopoly.message.server.PlayerStatusUpdate; @@ -182,8 +183,14 @@ public class ServerGameLogic implements ClientInterpreter { send(next, new NextPlayerTurn()); send(next, new PlayerStatusUpdate(playerHandler)); send(player, new PlayerStatusUpdate(playerHandler)); + } else { + send(player, new GameOver(false)); + playerHandler.removePlayer(player); } } + if(playerHandler.getPlayers().size() == 1) { + send(playerHandler.getPlayerAtIndex(0), new GameOver(true)); + } updateAllPlayers(); } diff --git a/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java b/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java index 2fa1a50..ac65ca7 100644 --- a/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java +++ b/Projekte/monopoly/server/src/main/java/pp/monopoly/server/MonopolyServer.java @@ -41,6 +41,7 @@ import pp.monopoly.message.client.ViewAssetsRequest; import pp.monopoly.message.server.BuyPropertyRequest; import pp.monopoly.message.server.DiceResult; import pp.monopoly.message.server.EventDrawCard; +import pp.monopoly.message.server.GameOver; import pp.monopoly.message.server.GameStart; import pp.monopoly.message.server.JailEvent; import pp.monopoly.message.server.NextPlayerTurn; @@ -176,6 +177,7 @@ public class MonopolyServer implements MessageListener, Connec Serializer.registerClass(NotificationMessage.class); Serializer.registerClass(JailEvent.class); Serializer.registerClass(AlterProperty.class); + Serializer.registerClass(GameOver.class); } private void registerListeners() {