/** * Gets the team where a player belongs. * * @param p The player we are checking. * @return The team where the player belongs. Returns null if it doesn't belong to any team. */ public Team getTeamByPlayer(Player p) { Team[] teams = listTeams(); if (teams == null) return null; for (Team t : teams) { if (t.isInTeam(p)) return t; } return null; }