Exemplo n.º 1
0
  public WeaponManager(Hunted plugin) {
    this.plugin = plugin;
    weaponTypes = Arrays.asList(WeaponType.values());

    swordNames = Arrays.asList(SwordName.values());
    swordTitles = Arrays.asList(SwordTitle.values());

    bowNames = Arrays.asList(BowName.values());
    bowTitles = Arrays.asList(BowTitle.values());

    weaponEnchants = Arrays.asList(WeaponEnchant.values());
    rand = new Random();
  }
Exemplo n.º 2
0
 private WeaponType getRandomWeaponType(boolean ascented) {
   WeaponType type = weaponTypes.get(rand.nextInt(WeaponType.values().length + 1));
   if (ascented && !type.canBeAscented()) {
     while (!type.canBeAscented()) {
       type = weaponTypes.get(rand.nextInt(WeaponType.values().length + 1));
       if (type.canBeAscented()) {
         break;
       }
     }
   }
   return type;
 }
Exemplo n.º 3
0
 private String getRandomName(WeaponType type, boolean useTitle, boolean isAscented) {
   String prefix = ChatColor.WHITE + "";
   String name = "";
   if (isAscented) {
     prefix = ChatColor.GOLD + "";
   }
   if (type.isBow()) {
     name += prefix + bowNames.get(rand.nextInt(bowNames.size())).getName();
     if (useTitle) {
       name += ", ";
       name += bowTitles.get((rand.nextInt(bowTitles.size()))).getName();
     }
     return name;
   }
   name += prefix + swordNames.get(rand.nextInt(swordNames.size())).getName();
   if (useTitle) {
     name += ", ";
     name += swordTitles.get(rand.nextInt(swordTitles.size())).getName();
   }
   return name;
 }
Exemplo n.º 4
0
 private int getRandomDurability(WeaponType type) {
   return rand.nextInt(type.getType().getMaxDurability() - 40) + 40;
 }