diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2023-03-18 01:29:07 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-17 15:29:07 +0100 |
commit | 941525e2ec5d42e098f364ddeafcfced87df5918 (patch) | |
tree | eb65d69ae16a6a68c1c189f07c4c2adc753c7a5a /src/main/java | |
parent | 86cd165c1ad9a72567cf5d033a8ff92779f72b30 (diff) | |
download | NotEnoughUpdates-941525e2ec5d42e098f364ddeafcfced87df5918.tar.gz NotEnoughUpdates-941525e2ec5d42e098f364ddeafcfced87df5918.tar.bz2 NotEnoughUpdates-941525e2ec5d42e098f364ddeafcfced87df5918.zip |
Fixed crash when item is set to ":" in /neurename (#661)
Fixed crash when item is set to ":"
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java index ecab042c..ece2f61c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCustomizeManager.java @@ -329,13 +329,14 @@ public class ItemCustomizeManager { public static Item getCustomItem(ItemStack stack) { ItemData data = getDataForItem(stack); - if (data == null || data.customItem == null || data.customItem.length() == 0) return stack.getItem(); + if (data == null || data.customItem == null || data.customItem.length() == 0 || data.customItem.split(":").length == 0) return stack.getItem(); Item newItem = Item.getByNameOrId(data.customItem.split(":")[0]); if (newItem == null) return stack.getItem(); return newItem; } public static Item getCustomItem(ItemStack stack, String newItemString) { + if (newItemString.split(":").length == 0) return stack.getItem(); Item newItem = Item.getByNameOrId(newItemString.split(":")[0]); if (newItem == null) return stack.getItem(); return newItem; @@ -386,7 +387,7 @@ public class ItemCustomizeManager { public static boolean hasCustomItem(ItemStack stack) { ItemData data = getDataForItem(stack); - if (data == null || data.customItem == null || data.customItem.length() == 0 || data.defaultItem == null || data.customItem.equals(data.defaultItem)) return false; + if (data == null || data.customItem == null || data.customItem.length() == 0 || data.defaultItem == null || data.customItem.equals(data.defaultItem) || data.customItem.split(":").length == 0) return false; Item item = Item.getByNameOrId(data.customItem.split(":")[0]); Item defaultItem = Item.getByNameOrId(data.defaultItem); if (item == null) { |