/** * Returns the team color of the given team. The team color is either sent by the game controller * or given by the GameController configuration. * * @param teamNumber number of the team * @return the team color * @see TeamInfo#teamColor */ public int getTeamColor(final int teamNumber) { Integer color = teamColors.get(teamNumber); if (color == null) { String[] colorStrings = null; try { if (teamNumber == 98 || teamNumber == 99) { Rules.league = Rules.LEAGUES[1]; } else { Rules.league = Rules.LEAGUES[0]; } colorStrings = Teams.getColors(teamNumber); } catch (final NullPointerException | ArrayIndexOutOfBoundsException e) { } if (colorStrings == null || colorStrings.length < 1) { if (teamNumber == teamNumbers[TEAM_RIGHT]) { return GameControlData.TEAM_RED; } else { return GameControlData.TEAM_BLUE; } } else if (colorStrings[0].equals("blue")) { return GameControlData.TEAM_BLUE; } else if (colorStrings[0].equals("red")) { return GameControlData.TEAM_RED; } else if (colorStrings[0].equals("yellow")) { return GameControlData.TEAM_YELLOW; } else { return GameControlData.TEAM_BLACK; } } return color; }