diff --git a/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java b/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java index 01882c6cc..46d3c9678 100644 --- a/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java +++ b/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java @@ -6,22 +6,5 @@ public enum AttributeSlot { FEET, LEGS, CHEST, - HEAD; - - public static AttributeSlot parse(String string) { - switch (string.toUpperCase()) { - case "OFFHAND": - return OFFHAND; - case "FEET": - return FEET; - case "LEGS": - return LEGS; - case "CHEST": - return CHEST; - case "HEAD": - return HEAD; - default: - return MAINHAND; - } - } + HEAD } diff --git a/src/main/java/net/minestom/server/utils/NBTUtils.java b/src/main/java/net/minestom/server/utils/NBTUtils.java index 33c7a78f5..786c9d057 100644 --- a/src/main/java/net/minestom/server/utils/NBTUtils.java +++ b/src/main/java/net/minestom/server/utils/NBTUtils.java @@ -176,9 +176,12 @@ public final class NBTUtils { break; } - final AttributeSlot attributeSlot = AttributeSlot.parse(slot.toUpperCase()); + AttributeSlot attributeSlot = AttributeSlot.valueOf(slot.toUpperCase()); // Wrong attribute slot, stop here + if (attributeSlot == null) + attributeSlot = AttributeSlot.MAINHAND; + // Add attribute final ItemAttribute itemAttribute = new ItemAttribute(uuid, name, attribute, attributeOperation, value, attributeSlot);