Fix null check

This commit is contained in:
themode 2021-02-22 14:06:47 +01:00
parent 60385c0887
commit 0cef390ff2

View File

@ -176,11 +176,13 @@ public final class NBTUtils {
break;
}
AttributeSlot attributeSlot = AttributeSlot.valueOf(slot.toUpperCase());
// Wrong attribute slot, stop here
if (attributeSlot == null)
// Find slot, default to the main hand if the nbt tag is invalid
AttributeSlot attributeSlot;
try {
attributeSlot = AttributeSlot.valueOf(slot.toUpperCase());
} catch (IllegalArgumentException e) {
attributeSlot = AttributeSlot.MAINHAND;
}
// Add attribute
final ItemAttribute itemAttribute =