Fix reported traps in Armor calculation when armor is incomplete - not
sure how this didn't happen more - possibly bukkit behavior change?
This commit is contained in:
parent
f722c6fdc8
commit
244419d686
1 changed files with 7 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package org.dynmap;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class Armor {
|
||||
/**
|
||||
|
|
@ -17,7 +18,12 @@ public class Armor {
|
|||
double baseArmorPoints = 0;
|
||||
ItemStack inventory[] = player.getInventory().getArmorContents();
|
||||
for(int i=0;i<inventory.length;i++) {
|
||||
final short maxDurability = inventory[i].getType().getMaxDurability();
|
||||
if(inventory[i] == null)
|
||||
continue;
|
||||
Material m = inventory[i].getType();
|
||||
if(m == null)
|
||||
continue;
|
||||
final short maxDurability = m.getMaxDurability();
|
||||
if(maxDurability < 0)
|
||||
continue;
|
||||
final short durability = inventory[i].getDurability();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue