コード例 #1
0
ファイル: RollsManager.java プロジェクト: ZammieWins/Wayward
 private double getArmourBonus(Character character, Stat stat) {
   Player player = character.getPlayer().getPlayer();
   double bonus = 0D;
   // Helmets
   if (player.getInventory().getHelmet() != null) {
     ItemStack helmet = player.getInventory().getHelmet();
     Material helmetType = helmet.getType();
     bonus +=
         plugin
             .getConfig()
             .getDouble("rolls.armour." + helmetType.toString() + "." + stat.toString());
     bonus += getEtBonus(helmet, stat);
     bonus += getEnchantmentBonus(helmet, stat);
   }
   // Chestplates
   if (player.getInventory().getChestplate() != null) {
     ItemStack chestplate = player.getInventory().getChestplate();
     Material chestplateType = chestplate.getType();
     bonus +=
         plugin
             .getConfig()
             .getDouble("rolls.armour." + chestplateType.toString() + "." + stat.toString());
     bonus += getEtBonus(chestplate, stat);
     bonus += getEnchantmentBonus(chestplate, stat);
   }
   // Leggings
   if (player.getInventory().getLeggings() != null) {
     ItemStack leggings = player.getInventory().getLeggings();
     Material leggingsType = leggings.getType();
     bonus +=
         plugin
             .getConfig()
             .getDouble("rolls.armour." + leggingsType.toString() + "." + stat.toString());
     bonus += getEtBonus(leggings, stat);
     bonus += getEnchantmentBonus(leggings, stat);
   }
   // Boots
   if (player.getInventory().getBoots() != null) {
     ItemStack boots = player.getInventory().getBoots();
     Material bootsType = boots.getType();
     bonus +=
         plugin
             .getConfig()
             .getDouble("rolls.armour." + bootsType.toString() + "." + stat.toString());
     bonus += getEtBonus(boots, stat);
     bonus += getEnchantmentBonus(boots, stat);
   }
   return bonus;
 }
コード例 #2
0
ファイル: RollsManager.java プロジェクト: ZammieWins/Wayward
 private double getWeaponBonus(Character character, Stat stat) {
   double bonus = 0D;
   Player player = character.getPlayer().getPlayer();
   Material weaponType = player.getItemInHand().getType();
   bonus +=
       plugin
           .getConfig()
           .getDouble("rolls.weapons." + weaponType.toString() + "." + stat.toString());
   bonus += getEtBonus(player.getItemInHand(), stat);
   bonus += getEnchantmentBonus(player.getItemInHand(), stat);
   return bonus;
 }
コード例 #3
0
ファイル: RollsManager.java プロジェクト: ZammieWins/Wayward
 private double getEnchantmentBonus(ItemStack item, Stat stat) {
   double bonus = 0D;
   if (item.hasItemMeta()) {
     ItemMeta meta = item.getItemMeta();
     if (meta.hasEnchants()) {
       for (Enchantment enchantment : meta.getEnchants().keySet()) {
         bonus +=
             meta.getEnchants().get(enchantment)
                 * plugin
                     .getConfig()
                     .getDouble("rolls.enchants." + enchantment.getName() + "." + stat.toString());
       }
     }
   }
   return bonus;
 }