mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-25 10:01:23 +01:00
Potential fix for unbreakingLevel NPE
This commit is contained in:
parent
daf1e15680
commit
0b4afabcdd
@ -20,7 +20,7 @@ import java.util.Random;
|
||||
public class DurabilityItem {
|
||||
private final NBTItem nbtItem;
|
||||
private final Player player;
|
||||
private int maxDurability , unbreakingLevel;
|
||||
private int maxDurability, unbreakingLevel;
|
||||
|
||||
private int durability;
|
||||
|
||||
@ -53,7 +53,10 @@ public class DurabilityItem {
|
||||
|
||||
durability = nbtItem.getInteger("MMOITEMS_DURABILITY");
|
||||
maxDurability = nbtItem.getInteger("MMOITEMS_MAX_DURABILITY");
|
||||
unbreakingLevel = nbtItem.getItem().getItemMeta().getEnchantLevel(Enchantment.DURABILITY);
|
||||
|
||||
unbreakingLevel = (nbtItem.getItem().getItemMeta() != null && nbtItem.getItem().getItemMeta().hasEnchant(Enchantment.DURABILITY)) ?
|
||||
nbtItem.getItem().getItemMeta().getEnchantLevel(Enchantment.DURABILITY) :
|
||||
0;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
|
Loading…
Reference in New Issue
Block a user