ACTUALLY fix the NPE here.

This commit is contained in:
GJ 2013-10-02 09:03:09 -04:00
parent a0ef0d5708
commit f87110749e

View File

@ -101,7 +101,15 @@ public class AxesManager extends SkillManager {
Material armorType = armor.getType(); Material armorType = armor.getType();
double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
double modifiedDurabilityDamage = durabilityDamage * durabilityModifier; double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
short maxDurability = (short) Math.max(armorType.getMaxDurability(), mcMMO.getRepairableManager().getRepairable(armorType).getMaximumDurability()); short maxDurability;
try {
maxDurability = mcMMO.getRepairableManager().getRepairable(armorType).getMaximumDurability();
}
catch (NullPointerException e) {
maxDurability = armorType.getMaxDurability();
}
double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier; double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier;
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability())); armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));