@Override
public void deal(MutableSeatedPlayer player)
throws IllegalActionException {
// Check whether the given player can do this action.
if (!onTurn(player)) {
throw new IllegalActionException(player.getName() + " can not deal in this round.");
}
game.unpauzeGame();
for (MutableSeatedPlayer newlySittingOut : game.getPlayersSittingOutNextRound().keySet()) {
newlySittingOut.setSittingIn(false);
for (Entry<MutableSeatedPlayer, Boolean> sitOutPlayer : game.getPlayersSittingOutNextRound().entrySet()) {
gameMediator
.publishSitOutEvent(new SitOutEvent(sitOutPlayer.getKey().getId()));
}
}
if (!(game.getTable().getNbPlayers() > 1)) {
throw new IllegalActionException("There should at least be 2 players to begin a new deal.");
}
playerMadeEvent(player);
// This will force the game control to end the waiting round
// and change to the preflop round.
}