From 7254ddcce3a2c938ba43610f106384ff5fb35c13 Mon Sep 17 00:00:00 2001 From: Focusvity Date: Mon, 2 Oct 2023 12:15:59 +1100 Subject: [PATCH] Fixed a NPE where an attribute name would start with minecraft: --- shared/src/main/java/dev/plex/itemizerx/Attributes.java | 2 +- src/main/java/dev/plex/itemizerx/ItemizerXCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/src/main/java/dev/plex/itemizerx/Attributes.java b/shared/src/main/java/dev/plex/itemizerx/Attributes.java index cf2640c..385a62d 100644 --- a/shared/src/main/java/dev/plex/itemizerx/Attributes.java +++ b/shared/src/main/java/dev/plex/itemizerx/Attributes.java @@ -34,7 +34,7 @@ public enum Attributes { for (Attributes attr : values()) { - if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name)) + if (attr.name().equalsIgnoreCase(name) || attr.mcName.equalsIgnoreCase(name.replace("minecraft:", ""))) { return attr; } diff --git a/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java index 8e661eb..7fff2b4 100644 --- a/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java @@ -295,7 +295,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase lores.set(index - 1, lore); meta.lore(lores); item.setItemMeta(meta); - sender.sendMessage(mm.deserialize("Line '" + index + "' has been changed to '" + mm.serialize(lore) + "'")); + sender.sendMessage(mm.deserialize("Line '" + index + "' has been changed to '" + mm.serialize(lore) + "'")); return true; } case "clear" ->