Пример #1
0
  //	@Override
  public static ItemList getRequiredList() {
    ItemList subList = new ItemList();

    subList.addItem(Material.CHAINMAIL_BOOTS.name(), 1);
    subList.addItem(Material.CHAINMAIL_CHESTPLATE.name(), 1);
    subList.addItem(Material.CHAINMAIL_HELMET.name(), 1);
    subList.addItem(Material.CHAINMAIL_LEGGINGS.name(), 1);
    subList.addItem(Material.DIAMOND_SWORD.name(), 1);

    return subList;
  }
Пример #2
0
  private void increaseArmorDurabilities(Player p) {
    short currentDurability = 0;
    ItemStack boots = p.getInventory().getBoots();
    ItemStack chest = p.getInventory().getChestplate();
    ItemStack legs = p.getInventory().getLeggings();
    ItemStack helm = p.getInventory().getHelmet();
    ItemStack air = new ItemStack(Material.AIR);
    Random rand = new Random();
    short maxDurability = 0;
    int leatherCheck = 200;
    int chainCheck = 66;
    int diamondCheck = 30;
    int goldCheck = 140;

    if (boots != null) {
      if (boots.getType() == Material.LEATHER_BOOTS && rand.nextInt(leatherCheck) == 0)
        maxDurability = Material.LEATHER_BOOTS.getMaxDurability();
      else if (boots.getType() == Material.CHAINMAIL_BOOTS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.CHAINMAIL_BOOTS.getMaxDurability();
      else if (boots.getType() == Material.IRON_BOOTS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.IRON_BOOTS.getMaxDurability();
      else if (boots.getType() == Material.DIAMOND_BOOTS && rand.nextInt(diamondCheck) == 0)
        maxDurability = Material.DIAMOND_BOOTS.getMaxDurability();
      else if (boots.getType() == Material.GOLD_BOOTS && rand.nextInt(goldCheck) == 0)
        maxDurability = Material.GOLD_BOOTS.getMaxDurability();

      if (maxDurability == 0) return;

      boots.setDurability((short) (boots.getDurability() + 1));
      currentDurability = boots.getDurability();

      if (currentDurability >= maxDurability) p.getInventory().setBoots(air);
      else p.getInventory().setBoots(boots);
    }

    if (chest != null) {
      if (chest.getType() == Material.LEATHER_CHESTPLATE && rand.nextInt(leatherCheck) == 0)
        maxDurability = Material.LEATHER_CHESTPLATE.getMaxDurability();
      else if (chest.getType() == Material.CHAINMAIL_CHESTPLATE && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.CHAINMAIL_CHESTPLATE.getMaxDurability();
      else if (chest.getType() == Material.IRON_CHESTPLATE && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.IRON_CHESTPLATE.getMaxDurability();
      else if (chest.getType() == Material.DIAMOND_CHESTPLATE && rand.nextInt(diamondCheck) == 0)
        maxDurability = Material.DIAMOND_CHESTPLATE.getMaxDurability();
      else if (chest.getType() == Material.GOLD_CHESTPLATE && rand.nextInt(goldCheck) == 0)
        maxDurability = Material.GOLD_CHESTPLATE.getMaxDurability();

      if (maxDurability == 0) return;

      chest.setDurability((short) (chest.getDurability() + 1));
      currentDurability = chest.getDurability();

      if (currentDurability >= maxDurability) p.getInventory().setChestplate(air);
      else p.getInventory().setChestplate(chest);
    }

    if (legs != null) {
      if (legs.getType() == Material.LEATHER_LEGGINGS && rand.nextInt(leatherCheck) == 0)
        maxDurability = Material.LEATHER_LEGGINGS.getMaxDurability();
      else if (legs.getType() == Material.CHAINMAIL_LEGGINGS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.CHAINMAIL_LEGGINGS.getMaxDurability();
      else if (legs.getType() == Material.IRON_LEGGINGS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.IRON_LEGGINGS.getMaxDurability();
      else if (legs.getType() == Material.DIAMOND_LEGGINGS && rand.nextInt(diamondCheck) == 0)
        maxDurability = Material.DIAMOND_LEGGINGS.getMaxDurability();
      else if (legs.getType() == Material.GOLD_LEGGINGS && rand.nextInt(goldCheck) == 0)
        maxDurability = Material.GOLD_LEGGINGS.getMaxDurability();

      if (maxDurability == 0) return;

      legs.setDurability((short) (legs.getDurability() + 1));
      currentDurability = legs.getDurability();

      if (currentDurability >= maxDurability) p.getInventory().setLeggings(air);
      else p.getInventory().setLeggings(legs);
    }

    if (helm != null) {
      if (helm.getType() == Material.LEATHER_LEGGINGS && rand.nextInt(leatherCheck) == 0)
        maxDurability = Material.LEATHER_LEGGINGS.getMaxDurability();
      else if (helm.getType() == Material.CHAINMAIL_LEGGINGS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.CHAINMAIL_LEGGINGS.getMaxDurability();
      else if (helm.getType() == Material.IRON_LEGGINGS && rand.nextInt(chainCheck) == 0)
        maxDurability = Material.IRON_LEGGINGS.getMaxDurability();
      else if (helm.getType() == Material.DIAMOND_LEGGINGS && rand.nextInt(diamondCheck) == 0)
        maxDurability = Material.DIAMOND_LEGGINGS.getMaxDurability();
      else if (helm.getType() == Material.GOLD_LEGGINGS && rand.nextInt(goldCheck) == 0)
        maxDurability = Material.GOLD_LEGGINGS.getMaxDurability();

      if (maxDurability == 0) return;

      helm.setDurability((short) (helm.getDurability() + 1));
      currentDurability = helm.getDurability();

      if (currentDurability >= maxDurability) p.getInventory().setHelmet(air);
      else p.getInventory().setHelmet(helm);
    }
  }