Fixed a possible null for attributeSlot

This commit is contained in:
ALS 2021-02-20 20:39:49 +01:00
parent 01ff9e2123
commit 0f9a2b5b4f
2 changed files with 19 additions and 2 deletions

View File

@ -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;
}
}
}

View File

@ -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