mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-01 06:33:38 +01:00
Merge pull request #233 from mikeprimm/master
Fix reported trap in Armor calculation when player has incomplete set of armor
This commit is contained in:
commit
654769af1e
@ -2,6 +2,7 @@ package org.dynmap;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class Armor {
|
public class Armor {
|
||||||
/**
|
/**
|
||||||
@ -17,7 +18,12 @@ public class Armor {
|
|||||||
double baseArmorPoints = 0;
|
double baseArmorPoints = 0;
|
||||||
ItemStack inventory[] = player.getInventory().getArmorContents();
|
ItemStack inventory[] = player.getInventory().getArmorContents();
|
||||||
for(int i=0;i<inventory.length;i++) {
|
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)
|
if(maxDurability < 0)
|
||||||
continue;
|
continue;
|
||||||
final short durability = inventory[i].getDurability();
|
final short durability = inventory[i].getDurability();
|
||||||
|
Loading…
Reference in New Issue
Block a user