@Override public ICard getCardFromCompetitor(String gameId, String playerId) throws IllegalStateException { IGame game = getGame(gameId); String currentState = game.getGameStatus(playerId).getGameState(); List<String> expectedStates = new LinkedList<>(); expectedStates.add(GameState.WaitForCommitRound.toString()); expectedStates.add(GameState.Aborted.toString()); if (!expectedStates.contains(currentState)) throw new IllegalStateException( "The competitors card is only accessible in state WaitForCommit."); int cardId = game.getCompetitorCardId(playerId); return cards[cardId]; }