Skip to content

Commit

Permalink
feat: only party leader can start the game
Browse files Browse the repository at this point in the history
  • Loading branch information
LapisBerry committed May 26, 2024
1 parent 03cfd71 commit f20253e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/lapisberry/gui/scenes/LobbyScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public static void updatePlayerList(LobbyController lobbyController) {
Platform.runLater(() -> {
PlayerPanel.PlayerList.vbox.getChildren().clear();
lobbyController.getPlayers().forEach(pair -> addPlayer(pair.getValue()));
if (Main.getClient().getClientId() != lobbyController.getPlayers().getFirst().getKey()) startButton.setDisable(true);
else startButton.setDisable(lobbyController.getPlayers().size() < 4 || lobbyController.getPlayers().size() > 8);
});
}

Expand Down Expand Up @@ -127,6 +129,7 @@ private StartButton(String text) {
setOnMouseExited(e -> setBackground(new Background(new BackgroundFill(Color.valueOf("44FF02"), new CornerRadii(40), null))));
setOnMousePressed(e -> setBackground(new Background(new BackgroundFill(Color.valueOf("2b850c"), new CornerRadii(40), null))));
setOnMouseReleased(e -> setBackground(new Background(new BackgroundFill(Color.valueOf("44FF02"), new CornerRadii(40), null))));
setOnAction(e -> System.out.println("Start Game!"));
}
}
}

0 comments on commit f20253e

Please sign in to comment.