Exemplo n.º 1
0
 /**
  * Broadcasts a message to all players in a world.
  *
  * @param message message to send
  * @param world Bukkit world object
  */
 public static void broadcast(String message, World world) {
   log("(" + world.getName().toUpperCase() + ") " + message);
   if (world != null)
     for (Player p : world.getPlayers()) {
       message(p, message);
     }
 }
Exemplo n.º 2
0
  @Override
  public OfflinePlayer[] getOfflinePlayers() {
    Set<OfflinePlayer> result = new HashSet<>();
    Set<UUID> uuids = new HashSet<>();

    // add the currently online players
    for (World world : getWorlds()) {
      for (Player player : world.getPlayers()) {
        result.add(player);
        uuids.add(player.getUniqueId());
      }
    }

    // add all offline players that aren't already online
    for (OfflinePlayer offline : getPlayerDataService().getOfflinePlayers()) {
      if (!uuids.contains(offline.getUniqueId())) {
        result.add(offline);
        uuids.add(offline.getUniqueId());
      }
    }

    return result.toArray(new OfflinePlayer[result.size()]);
  }