public void reloadFlyZones(boolean showMessage) {

    RocketInit.rocketZoneLocations.clear();
    List<String> zoneList = RocketInit.getPlugin().getConfig().getStringList("zones");

    if (zoneList.size() > 0) {

      for (String zone : zoneList) {

        String[] zoneSection = zone.split("\\|");

        final Location zoneLocationStart =
            new Location(
                Bukkit.getWorld(zoneSection[1]),
                Integer.parseInt(zoneSection[2]) - 25,
                Integer.parseInt(zoneSection[3]) - 5,
                Integer.parseInt(zoneSection[4]) - 25);

        final Location zoneLocationEnd =
            new Location(
                Bukkit.getWorld(zoneSection[1]),
                Integer.parseInt(zoneSection[2]) + 25,
                Integer.parseInt(zoneSection[3]) + 50,
                Integer.parseInt(zoneSection[4]) + 25);

        RocketInit.rocketZoneLocations.put(
            UUID.fromString(zoneSection[0]),
            new ConcurrentHashMap<Location, Location>() {
              {
                put(zoneLocationStart, zoneLocationEnd);
              }
            });
      }

      if (showMessage) RocketInit.registerMap.put("zone", zoneList.size());
    }
  }
Esempio n. 2
0
 /**
  * Broadcasts a message to all players in a world.
  *
  * @param message message to send
  * @param world world name
  */
 public static void broadcast(String message, String world) {
   World bw;
   if ((bw = Bukkit.getWorld(world)) == null) return;
   log(message);
   broadcast(message, bw);
 }