/** * Returns the player that matches the given class and format. * * @param profileClass The class to match. * @param ext The format to match. * @return The player if a match could be found, <code>null</code> otherwise. */ public static Player getPlayer(final Class<? extends Player> profileClass, final Format ext) { for (Player player : players) { if (player.getClass().equals(profileClass) && player.type() == ext.getType() && !player.excludeFormat(ext)) { return player; } } return null; }
/** * Returns the players matching the given classes and type. * * @param profileClasses The classes to match. * @param type The type to match. * @return The list of players that match. If no players match, an empty list is returned. */ public static ArrayList<Player> getPlayers( final ArrayList<Class<? extends Player>> profileClasses, final int type) { ArrayList<Player> compatiblePlayers = new ArrayList<Player>(); for (Player player : players) { if (profileClasses.contains(player.getClass()) && player.type() == type) { compatiblePlayers.add(player); } } return compatiblePlayers; }