diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index f9173dd..8beb8ba 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -103,6 +103,8 @@ public class Toolbar extends Dialog implements GameEventListener { */ private volatile DiceRollEvent latestDiceRollEvent = null; + private boolean bankruptPopUp = false; + /** * Constructs the toolbar for the Monopoly application. *
@@ -256,9 +258,11 @@ public class Toolbar extends Dialog implements GameEventListener { endTurnButton.setPreferredSize(new Vector3f(150, 50, 0)); endTurnButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); - if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0) { + if (app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getAccountBalance() < 0 && !bankruptPopUp) { new Bankrupt(app).open(); + bankruptPopUp = true; } else { + bankruptPopUp = false; app.getGameLogic().send(new EndTurn()); receivedEvent(new ButtonStatusEvent(false)); }