Ejemplo n.º 1
0
  static {
    try {
      Plugin wgp = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
      hasWG = wgp != null; // Short and sweet
      if (hasWG) wg = (WorldGuardPlugin) wgp;
      hasResidence = Bukkit.getServer().getPluginManager().getPlugin("Residence") != null;
      log = Storm.instance.getLogger();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 2
0
  /**
   * Gets player within range.
   *
   * @param location the centre of the range
   * @param radius the radius of the range
   * @return a set of Bukkit player objects
   */
  public static Set<Player> getNearbyPlayers(Location location, double radius) {
    Set<Player> playerList = new HashSet<Player>();
    World locWorld = location.getWorld();
    radius *= radius;

    for (Player p : Bukkit.getServer().getOnlinePlayers()) {
      if (p.getWorld().equals(locWorld)) {
        if (p.getLocation().distanceSquared(location) <= radius) {
          playerList.add(p);
        }
      }
    }

    return playerList;
  }
Ejemplo n.º 3
0
 public FakeServer() {
   if (Bukkit.getServer() == null) {
     Bukkit.setServer(this);
   }
 }
Ejemplo n.º 4
0
 /**
  * Broadcasts a message to all players.
  *
  * @param message message to send
  */
 public static void broadcast(String message) {
   if (!message.isEmpty()) {
     Bukkit.getServer().broadcastMessage(parseColors(message));
   }
 }