Exemplo n.º 1
0
 @Override
 public Player getActivePlayer(User user, Game game) {
   for (Player p : user.getProfile().getPlayers()) {
     for (Player gamePlayer : game.getPlayers()) {
       if (gamePlayer.getPlayerId() == p.getPlayerId()) {
         return gamePlayer;
       }
     }
   }
   throw new SpaceCrackUnexpectedException("This user isn't playing this game");
 }
Exemplo n.º 2
0
 private void checkLost(Game gameByGameId) {
   for (Player player : gameByGameId.getPlayers()) {
     if (player.getColonies().size() == 0) {
       gameByGameId.setLoserPlayerId(player.getPlayerId());
     }
   }
 }