From 9c788a27d677c17dcc2163440f0b73fd202e316d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 8 Dec 2022 20:34:42 +0100 Subject: [PATCH] Hotfix AttributeRemoveCommand Signed-off-by: yoyosource --- .../attributescopy/AttributeRemoveCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java index ab822fc2..0edd3b73 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java @@ -56,7 +56,15 @@ public class AttributeRemoveCommand extends SWCommand { public void genericCommand(Player player, @Mapper("attribute") String attribute) { ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemMeta itemMeta = itemStack.getItemMeta(); + if (itemMeta == null) { + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); + return; + } List lore = itemMeta.getLore(); + if (lore == null) { + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); + return; + } if (lore.isEmpty()) { BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); return; @@ -83,7 +91,9 @@ public class AttributeRemoveCommand extends SWCommand { Player player = (Player) commandSender; ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemMeta itemMeta = itemStack.getItemMeta(); + if (itemMeta == null) return null; List lore = itemMeta.getLore(); + if (lore == null) return null; if (lore.isEmpty()) return null; if (!lore.get(0).equals("§eAttributes§8:")) return null; return lore.stream()