@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; }
@Override public List<Player> matchPlayer(String name) { name = name.toLowerCase(); ArrayList<Player> result = new ArrayList<>(); for (Player player : getOnlinePlayers()) { String lower = player.getName().toLowerCase(); if (lower.equals(name)) { result.clear(); result.add(player); break; } else if (lower.contains(name)) { result.add(player); } } return result; }