コード例 #1
0
 @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;
 }
コード例 #2
0
ファイル: GlowServer.java プロジェクト: hef/Glowstone
 /**
  * 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()]);
 }