예제 #1
0
 @Override
 public Set<OfflinePlayer> getOperators() {
   Set<OfflinePlayer> offlinePlayers = new HashSet<>();
   for (UUID uuid : opsList.getUUIDs()) {
     offlinePlayers.add(getOfflinePlayer(uuid));
   }
   return offlinePlayers;
 }
예제 #2
0
 @Override
 public Set<String> getIPBans() {
   Set<String> result = new HashSet<>();
   for (BanEntry entry : ipBans.getBanEntries()) {
     result.add(entry.getTarget());
   }
   return result;
 }
예제 #3
0
 @Override
 public Set<OfflinePlayer> getBannedPlayers() {
   Set<OfflinePlayer> bannedPlayers = new HashSet<>();
   for (BanEntry entry : nameBans.getBanEntries()) {
     bannedPlayers.add(getOfflinePlayer(entry.getTarget()));
   }
   return bannedPlayers;
 }
예제 #4
0
 @Override
 public Set<OfflinePlayer> getWhitelistedPlayers() {
   Set<OfflinePlayer> players = new HashSet<>();
   for (UUID uuid : whitelist.getUUIDs()) {
     players.add(getOfflinePlayer(uuid));
   }
   return players;
 }
예제 #5
0
 public Location getSurfaceAt(Location origin) {
   Chunk chunky = origin.getChunk();
   int x = origin.getBlockX(),
       z = origin.getBlockZ(),
       surface = 0,
       envid = origin.getWorld().getEnvironment().getId();
   Set dimmap =
       Sets.newHashSet(envid == 0 ? new int[] {1, 2, 3, 7, 15, 16} : envid == -1 ? 87 : 121);
   for (int y = 0; y != 256; y++)
     if (dimmap.contains(chunky.getBlock(x, y, z).getTypeId())) surface = y;
   return chunky.getBlock(x, surface, z).getLocation();
 }
예제 #6
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;
  }
예제 #7
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()]);
  }
예제 #8
0
  public String[] getDungeonList() {

    Set<String> set = this.dungeons.keySet();

    return set.toArray(new String[set.size()]);
  }
예제 #9
0
 @Override
 public void addPermission(Permission prmsn) {
   permissions.add(prmsn);
 }
예제 #10
0
 /**
  * Is the biome covered with snow?
  *
  * @param b biome to check
  * @return boolean
  */
 public static boolean isTundra(Biome b) {
   return snowyBiomes.contains(b);
 }
예제 #11
0
 /**
  * Is the biome a desert?
  *
  * @param b biome to check
  * @return boolean
  */
 public static boolean isDesert(Biome b) {
   return desertBiomes.contains(b);
 }
예제 #12
0
 /**
  * Is the biome a forest?
  *
  * @param b biome to check
  * @return boolean
  */
 public static boolean isForest(Biome b) {
   return forestBiomes.contains(b) || jungleBiomes.contains(b);
 }
예제 #13
0
 /**
  * Can the biome rain?
  *
  * @param b biome to check
  * @return boolean
  */
 public static boolean isRainy(Biome b) {
   return rainBiomes.contains(b);
 }
예제 #14
0
 public void logOnce(String error_id, String msg) {
   if (log_once.contains(error_id)) return;
   log_once.add(error_id);
   log.info(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', px + msg)));
 }
예제 #15
0
파일: Conf.java 프로젝트: Tovex/Factions
  static {
    territoryProtectedMaterials.add(Material.WOODEN_DOOR);
    territoryProtectedMaterials.add(Material.TRAP_DOOR);
    territoryProtectedMaterials.add(Material.DISPENSER);
    territoryProtectedMaterials.add(Material.CHEST);
    territoryProtectedMaterials.add(Material.FURNACE);

    territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
    territoryDenyUseageMaterials.add(Material.BUCKET);
    territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
    territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);

    territoryProtectedMaterialsWhenOffline.add(Material.WOODEN_DOOR);
    territoryProtectedMaterialsWhenOffline.add(Material.TRAP_DOOR);
    territoryProtectedMaterialsWhenOffline.add(Material.DISPENSER);
    territoryProtectedMaterialsWhenOffline.add(Material.CHEST);
    territoryProtectedMaterialsWhenOffline.add(Material.FURNACE);

    territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
    territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
    territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
    territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);

    safeZoneNerfedCreatureTypes.add(CreatureType.CREEPER);
    safeZoneNerfedCreatureTypes.add(CreatureType.GHAST);
    safeZoneNerfedCreatureTypes.add(CreatureType.PIG_ZOMBIE);
    safeZoneNerfedCreatureTypes.add(CreatureType.SKELETON);
    safeZoneNerfedCreatureTypes.add(CreatureType.SPIDER);
    safeZoneNerfedCreatureTypes.add(CreatureType.SLIME);
    safeZoneNerfedCreatureTypes.add(CreatureType.ZOMBIE);
  }
예제 #16
0
  public void interactRocketBoots(InventoryClickEvent event, ItemStack boots) {

    Player player = (Player) event.getWhoClicked();
    ClickType click = event.getClick();
    Boolean hasRocketMeta = boots.hasItemMeta();

    if (gamemodeCheck.check(player, GameMode.CREATIVE, GameMode.SPECTATOR)) {
      event.setCancelled(true);
      player.closeInventory();
      disableRocketBoots(player, false, false, false, false, false);
      commonString.messageSend(
          RocketInit.getPlugin(), player, true, RocketLanguage.RB_GAMEMODE_ERROR);
      return;
    }

    if (hasRocketMeta) {

      ItemMeta rocketMeta = boots.getItemMeta();

      if (rocketMeta.hasDisplayName())
        if (rocketMeta.getDisplayName().matches(ChatColor.RED + "Rocket Boots"))
          if (rocketMeta.hasLore()) {

            String rocketLore = rocketMeta.getLore().get(0);
            String variantLore = null;

            if (rocketMeta.getLore().size() >= 2)
              variantLore = ChatColor.stripColor(rocketMeta.getLore().get(1));

            Set<String> specialVariants = new HashSet<>(Collections.singletonList("Robin Hood"));

            if (variantLore != null)
              if (specialVariants.contains(variantLore)) {

                Variant variantType = Variant.getEnum(variantLore);

                if (variantType != null)
                  if (variantType == Variant.MONEY)
                    if (RocketInit.getVaultEconomy() == null) {
                      commonString.messageSend(
                          RocketInit.getPlugin(), player, true, RocketLanguage.RB_EQUIP_ERROR);
                      return;
                    }
              }

            if (rocketLore.matches(ChatColor.YELLOW + "Rocket Level I{0,3}V?X?"))
              if (!RocketInit.rocketUsage.contains(player.getUniqueId()))
                if (click == ClickType.MIDDLE) event.setCancelled(true);
                else attachRocketBoots(player, boots);
          }

    } else if (RocketInit.rocketSprint.containsKey(player.getUniqueId())) {

      commonString.messageSend(
          RocketInit.getPlugin(),
          player,
          true,
          new String[] {RocketLanguage.RB_COOLDOWN_TOUCH, RocketLanguage.RB_COOLDOWN_LAND});

      event.setCancelled(true);
      player.closeInventory();

    } else if (RocketInit.rocketPower.containsKey(player.getUniqueId()))
      disableRocketBoots(player, false, false, false, false, false);
  }