Package us.deathmarine.diablodrops.tier

Examples of us.deathmarine.diablodrops.tier.Tier


    while (mat == null) {
      mat = dropPicker();
    }
    Material material = mat;
    ItemStack ci = null;
    Tier tier = getTier();
    while (tier == null) {
      tier = getTier();
    }
    if ((tier.getMaterials().size() > 0)
        && !tier.getMaterials().contains(material)) {
      material = tier.getMaterials().get(
          plugin.getSingleRandom()
              .nextInt(tier.getMaterials().size()));
    }
    int e = tier.getAmount();
    int l = tier.getLevels();
    short damage = 0;
    if (plugin.getConfig().getBoolean("DropFix.Damage", true)) {
      damage = damageItemStack(mat);
    }
    if (plugin.getConfig().getBoolean("Display.TierName", true)
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      ci = new Drop(material, tier.getColor(),
          ChatColor.stripColor(name(mat)), damage, tier.getColor()
              + "Tier: " + tier.getDisplayName());
    } else if (plugin.getConfig().getBoolean("Display.TierName", true)
        && tier.getColor().equals(ChatColor.MAGIC)) {
      ci = new Drop(material, tier.getColor(),
          ChatColor.stripColor(name(mat)), damage, ChatColor.WHITE
              + "Tier: " + tier.getDisplayName());
    } else {
      ci = new Drop(material, tier.getColor(),
          ChatColor.stripColor(name(mat)), damage);
    }
    if (tier.getColor().equals(ChatColor.MAGIC))
      return ci;
    List<Enchantment> eStack = Arrays.asList(Enchantment.values());
    boolean safe = plugin.getConfig().getBoolean("SafeEnchant.Enabled",
        true);
    if (safe) {
      eStack = getEnchantStack(ci);
    }
    for (; e > 0; e--) {
      int lvl = plugin.getSingleRandom().nextInt(l + 1);
      int size = eStack.size();
      if (size < 1) {
        continue;
      }
      Enchantment ench = eStack.get(plugin.getSingleRandom()
          .nextInt(size));
      if (!ci.containsEnchantment(ench))
        if ((lvl != 0) && (ench != null)
            && !tier.getColor().equals(ChatColor.MAGIC))
          if (safe) {
            if ((lvl >= ench.getStartLevel())
                && (lvl <= ench.getMaxLevel())) {
              try {
                ci.addEnchantment(ench, lvl);
              } catch (Exception e1) {
                if (plugin.getDebug()) {
                  plugin.log.warning(e1.getMessage());
                }
                e++;
              }
            }
          } else {
            ci.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta tool;
    if (ci.hasItemMeta())
      tool = ci.getItemMeta();
    else
      tool = Bukkit.getItemFactory().getItemMeta(ci.getType());
    tool.setLore(tier.getLore());
    List<String> list = new ArrayList<String>();
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
View Full Code Here


  public ItemStack getItem(final ItemStack oldTool) {
    ItemStack tool = oldTool;
    short oldDam = tool.getDurability();
    tool = new ItemStack(tool.getType());
    tool.setDurability(oldDam);
    Tier tier = getTier();
    while ((tier == null) || tier.getColor().equals(ChatColor.MAGIC)) {
      tier = getTier();
    }
    int e = tier.getAmount();
    int l = tier.getLevels();
    List<String> list = new ArrayList<String>();
    if (plugin.getSettings().isColorBlindCompat()) {
      list.add("Material: " + getPrettyMaterialName(tool.getType()));
    }
    if (plugin.getConfig().getBoolean("Display.TierName", true)) {
      list.add(tier.getColor() + "Tier: " + tier.getDisplayName());
    }
    for (String s : tier.getLore())
      if (s != null) {
        list.add(s);
      }
    List<Enchantment> eStack = Arrays.asList(Enchantment.values());
    boolean safe = plugin.getConfig().getBoolean("SafeEnchant.Enabled",
        true);
    if (safe) {
      eStack = getEnchantStack(tool);
    }
    for (; e > 0; e--) {
      int lvl = plugin.getSingleRandom().nextInt(l + 1);
      int size = eStack.size();
      if (size < 1) {
        continue;
      }
      Enchantment ench = eStack.get(plugin.getSingleRandom()
          .nextInt(size));
      if (!tool.containsEnchantment(ench))
        if ((lvl != 0) && (ench != null)
            && !tier.getColor().equals(ChatColor.MAGIC))
          if (safe) {
            if ((lvl >= ench.getStartLevel())
                && (lvl <= ench.getMaxLevel())) {
              try {
                tool.addEnchantment(ench, lvl);
              } catch (Exception e1) {
                if (plugin.getDebug()) {
                  plugin.log.warning(e1.getMessage());
                }
                e++;
              }
            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    meta.setDisplayName(tier.getColor() + name(tool.getType()));
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(100) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(tool.getType())) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
View Full Code Here

  public ItemStack getItem(Material mat) {
    while (mat == null) {
      mat = dropPicker();
    }
    ItemStack ci = null;
    Tier tier = getTier();
    while (tier == null) {
      tier = getTier();
    }
    if ((tier.getMaterials().size() > 0)
        && !tier.getMaterials().contains(mat)) {
      mat = tier.getMaterials().get(
          plugin.getSingleRandom()
              .nextInt(tier.getMaterials().size()));
    }
    int e = tier.getAmount();
    int l = tier.getLevels();
    short damage = 0;
    if (plugin.getConfig().getBoolean("DropFix.Damage", true)) {
      damage = damageItemStack(mat);
    }
    List<String> startList = new ArrayList<String>();
    if (plugin.getSettings().isColorBlindCompat()) {
      startList.add("Material: " + getPrettyMaterialName(mat));
    }
    if (plugin.getConfig().getBoolean("Display.TierName", true)
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      startList.add(tier.getColor() + "Tier: " + tier.getDisplayName());
    } else if (plugin.getConfig().getBoolean("Display.TierName", true)
        && tier.getColor().equals(ChatColor.MAGIC)) {
      startList.add(ChatColor.WHITE + "Tier: " + tier.getDisplayName());
    }
    ci = new Drop(mat, tier.getColor(), ChatColor.stripColor(name(mat)),
        damage, startList.toArray(new String[0]));
    if (tier.getColor().equals(ChatColor.MAGIC))
      return ci;
    ItemStack tool = new ItemStack(ci);
    List<Enchantment> eStack = Arrays.asList(Enchantment.values());
    List<String> list = new ArrayList<String>();
    for (String s : tier.getLore())
      if (s != null) {
        list.add(s);
      }

    boolean safe = plugin.getConfig().getBoolean("SafeEnchant.Enabled",
        true);
    if (safe) {
      eStack = getEnchantStack(tool);
    }
    for (; e > 0; e--) {
      int lvl = plugin.getSingleRandom().nextInt(l + 1);
      int size = eStack.size();
      if (size < 1) {
        continue;
      }
      Enchantment ench = eStack.get(plugin.getSingleRandom()
          .nextInt(size));
      if (!tool.containsEnchantment(ench))
        if ((lvl != 0) && (ench != null)
            && !tier.getColor().equals(ChatColor.MAGIC))
          if (safe) {
            if ((lvl >= ench.getStartLevel())
                && (lvl <= ench.getMaxLevel())) {
              try {
                tool.addEnchantment(ench, lvl);
              } catch (Exception e1) {
                if (plugin.getDebug()) {
                  plugin.log.warning(e1.getMessage());
                }
                e++;
              }
            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(mat)) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
View Full Code Here

   *            Tier of ItemStack
   * @return ItemStack with a Material of passMat and a Tier of passTier
   */
  public ItemStack getItem(Material passMat, Tier passTier) {
    Material mat = passMat;
    Tier tier = passTier;
    while (mat == null) {
      mat = dropPicker();
    }
    ItemStack ci = null;
    while (tier == null) {
      tier = getTier();
    }
    if ((tier.getMaterials().size() > 0)
        && !tier.getMaterials().contains(mat)) {
      mat = tier.getMaterials().get(
          plugin.getSingleRandom()
              .nextInt(tier.getMaterials().size()));
    }
    int e = tier.getAmount();
    int l = tier.getLevels();
    short damage = 0;
    if (plugin.getConfig().getBoolean("DropFix.Damage", true)) {
      damage = damageItemStack(mat);
    }
    List<String> startList = new ArrayList<String>();
    if (plugin.getSettings().isColorBlindCompat()) {
      startList.add("Material: " + getPrettyMaterialName(mat));
    }
    if (plugin.getConfig().getBoolean("Display.TierName", true)
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      startList.add(tier.getColor() + "Tier: " + tier.getDisplayName());
    } else if (plugin.getConfig().getBoolean("Display.TierName", true)
        && tier.getColor().equals(ChatColor.MAGIC)) {
      startList.add(ChatColor.WHITE + "Tier: " + tier.getDisplayName());
    }
    ci = new Drop(mat, tier.getColor(), ChatColor.stripColor(name(mat)),
        damage, startList.toArray(new String[0]));
    if (tier.getColor().equals(ChatColor.MAGIC))
      return ci;
    ItemStack tool = new ItemStack(ci);
    List<Enchantment> eStack = Arrays.asList(Enchantment.values());
    List<String> list = new ArrayList<String>();
    for (String s : tier.getLore())
      if (s != null) {
        list.add(s);
      }
    boolean safe = plugin.getConfig().getBoolean("SafeEnchant.Enabled",
        true);
    if (safe) {
      eStack = getEnchantStack(tool);
    }
    for (; e > 0; e--) {
      int lvl = plugin.getSingleRandom().nextInt(l + 1);
      int size = eStack.size();
      if (size < 1) {
        continue;
      }
      Enchantment ench = eStack.get(plugin.getSingleRandom()
          .nextInt(size));
      if (!tool.containsEnchantment(ench))
        if ((lvl != 0) && (ench != null)
            && !tier.getColor().equals(ChatColor.MAGIC))
          if (safe) {
            if ((lvl >= ench.getStartLevel())
                && (lvl <= ench.getMaxLevel())) {
              try {
                tool.addEnchantment(ench, lvl);
              } catch (Exception e1) {
                if (plugin.getDebug()) {
                  plugin.log.warning(e1.getMessage());
                }
                e++;
              }
            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(mat)) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
View Full Code Here

      }
      List<String> lore = new ArrayList<String>();
      for (String s : cs.getStringList(name + ".Lore"))
        if (s != null)
          lore.add(ChatColor.translateAlternateColorCodes('&', s));
      plugin.tiers.add(new Tier(name, ChatColor.valueOf(color
          .toUpperCase()), Math.abs(amt), Math.abs(lvl), Math
          .abs((int) (chance * 100)), l, lore, cs.getString(name
          + ".DisplayName", name), ((float) cs.getDouble(name
          + ".DropChance", 100)) / 100));
    }
View Full Code Here

   */
  public Tier getTier(ItemStack item) {
    if (!item.hasItemMeta() || !item.getItemMeta().hasLore())
      return null;
    for (String s : item.getItemMeta().getLore()) {
      Tier tier = getTier(s);
      if (tier != null)
        return tier;
    }
    return null;
  }
View Full Code Here

            if (name.equals(""))
              name = s;
            else
              name = name + " " + s;
        }
        Tier tier = plugin.getDropAPI().getTier(name);
        ItemStack customItem = plugin.getDropAPI().getItem(tier);
        if (customItem != null && p != null) {
          p.getInventory().addItem(customItem);
          p.sendMessage(ChatColor.GREEN
              + "You have been given a DiabloDrops item.");
View Full Code Here

      for (ItemStack cis : eswi.getItems()) {
        if (cis != null) {
          float dropChance = 2.0F;
          if (true) {
            Tier tier = plugin.getDropAPI().getTier(cis);
            if (tier != null)
              dropChance = (tier.getDropChance() * 0.01F);
          }
          if (plugin.getItemAPI().isHelmet(cis.getType())
              || cis.getType().equals(Material.SKULL_ITEM)) {
            entity.getEquipment().setHelmet(cis);
            entity.getEquipment().setHelmetDropChance(dropChance);
View Full Code Here

TOP

Related Classes of us.deathmarine.diablodrops.tier.Tier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.