/** Action taken on button click Continue. Creates a player or displays an error. */ @FXML public final void confirmChoices() { if (textName.getText().isEmpty()) { lblWarning.setText("Please enter a name."); } else { if (playerCount > 0) { // Gets the currently picked color final String pickedColor = cmbColor.getValue(); // Create new player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Add new player // Remove picked Color from list cmbColor.getItems().remove(pickedColor); // Sets combo boxes back to zero index cmbColor.getSelectionModel().select(0); cmbRace.getSelectionModel().select(0); textName.clear(); lblWarning.setText(""); playerCount--; // Decrement player count after creation playerNum++; // Increment player Label number lblPlayerNum.setText("Player " + playerNum + ": Choose Your Options"); } else { // If just one player, and end case for last player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Display the map Screen to start game main.showMapScreen(); } } }