Example #1
0
  /**
   * Build item stack.
   *
   * @return the item stack
   */
  @Override
  public ItemStack build() {

    setStack(new ItemStack(getMaterial(), getAmount()));

    if ((Short) getDurability() != null) {
      getStack().setDurability(getDurability());
    }

    if (getDisplayName() != null)
      meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getDisplayName()));

    if (getLore() != null) meta.setLore(getLore());

    if (getEnchantments() != null) {
      for (Enchant enchant : getEnchantments()) {

        meta.addEnchant(enchant.enchantment(), enchant.level(), enchant.force());
      }
    }

    if (isUnbreaking()) {

      meta.spigot().setUnbreakable(true);
    }

    getStack().setItemMeta(meta);

    return getStack();
  }
Example #2
0
  private void runComparison() {
    Calculations m = Calculations.createInstance();
    m.calculate(setup, gear);
    defaultDPS = m.getTotalDPS();

    Collection<Enchant> enchants;
    SlotType slotType = SlotType.Trinket;
    switch (slot) {
      case 0:
        slotType = SlotType.Head;
        break;
      case 2:
        slotType = SlotType.Shoulder;
        break;
      case 3:
        slotType = SlotType.Back;
        break;
      case 4:
        slotType = SlotType.Chest;
        break;
      case 7:
        slotType = SlotType.Wrist;
        break;
      case 8:
        slotType = SlotType.Hands;
        break;
      case 10:
        slotType = SlotType.Legs;
        break;
      case 11:
        slotType = SlotType.Feet;
        break;
      case 12:
      case 13:
        slotType = SlotType.Finger;
        break;
      case 16:
      case 17:
        slotType = SlotType.OneHand;
        break;
    }
    enchants = Enchant.findSlot(slotType);

    for (Enchant e : enchants) {
      gear.setEnchant(slot, e);
      m.calculate(setup, gear);
      e.setComparedDPS(m.getTotalDPS() - defaultDPS);
      comparedEnchants.add(e);
    }
    Collections.sort(comparedEnchants);
  }