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 46d3c9678..01882c6cc 100644 --- a/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java +++ b/src/main/java/net/minestom/server/item/attribute/AttributeSlot.java @@ -6,5 +6,22 @@ public enum AttributeSlot { FEET, LEGS, CHEST, - HEAD + 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; + } + } } diff --git a/src/main/java/net/minestom/server/utils/NBTUtils.java b/src/main/java/net/minestom/server/utils/NBTUtils.java index 145c3ad36..469882a7d 100644 --- a/src/main/java/net/minestom/server/utils/NBTUtils.java +++ b/src/main/java/net/minestom/server/utils/NBTUtils.java @@ -176,7 +176,7 @@ public final class NBTUtils { break; } - final AttributeSlot attributeSlot = AttributeSlot.valueOf(slot.toUpperCase()); + final AttributeSlot attributeSlot = AttributeSlot.parse(slot.toUpperCase()); // Wrong attribute slot, stop here // Add attribute