@Override public Collection<GlowPlayer> getOnlinePlayers() { // todo: provide a view instead of reassembling the list each time ArrayList<GlowPlayer> result = new ArrayList<>(); for (GlowWorld world : worlds.getWorlds()) { for (GlowPlayer player : world.getRawPlayers()) { result.add(player); } } return result; }
/** * Gets every player that has ever played on this server. * * @return Array containing all players */ public OfflinePlayer[] getOfflinePlayers() { Set<OfflinePlayer> result = new HashSet<OfflinePlayer>(); for (GlowWorld world : worlds) { result.addAll(world.getRawPlayers()); for (String name : world.getMetadataService().getPlayerNames()) { OfflinePlayer offline = getOfflinePlayer(name); if (!result.contains(offline)) { result.add(offline); } } } return result.toArray(new OfflinePlayer[result.size()]); }