From 045e60715e595609b2a56dc21b1e7ea37da97da6 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 23 Feb 2021 17:40:04 +0000 Subject: [PATCH] Removed legacy lore lines from before eco 4.0.0 --- .../ecoenchants/display/EnchantDisplay.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index 0349e875..8f61cfdb 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -192,6 +192,21 @@ public class EnchantDisplay extends DisplayModule { } ItemMeta meta = itemStack.getItemMeta(); + List itemLore; + + if (meta.hasLore()) { + itemLore = meta.getLore(); + } else { + itemLore = new ArrayList<>(); + } + + if (itemLore == null) { + itemLore = new ArrayList<>(); + } + + itemLore.removeIf(s -> s.startsWith("§w")); + + meta.setLore(itemLore); if (!meta.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) { meta.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS); @@ -199,5 +214,9 @@ public class EnchantDisplay extends DisplayModule { } meta.getPersistentDataContainer().remove(keySkip); itemStack.setItemMeta(meta); + + if (itemStack.getItemMeta() == null) { + return; + } } }