From 2ec9ce4e60efe26d00f37e988f75d2fa5a2fe6a6 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 12 Sep 2020 15:48:43 +0100 Subject: [PATCH] Changed hidden prefix --- .../com/willfp/ecoenchants/display/EnchantDisplay.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index 7b5d4766..385165d9 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -8,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.EnchantmentTarget; import com.willfp.ecoenchants.util.NumberUtils; import org.apache.commons.lang.WordUtils; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -38,7 +39,7 @@ public class EnchantDisplay { */ public static final NamespacedKey keySkip = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-skip"); - private static final String prefix = ChatColor.translateAlternateColorCodes('&',"&a&e&a&r"); + private static final String prefix = ChatColor.COLOR_CHAR + "w"; private static String normalColor; private static String curseColor; @@ -96,19 +97,17 @@ public class EnchantDisplay { if(meta.hasLore()) itemLore = meta.getLore(); - if(itemLore == null) itemLore = new ArrayList<>(); - try { if (meta.getPersistentDataContainer().has(key, PersistentDataType.INTEGER)) { int enchantLoreLength = meta.getPersistentDataContainer().get(key, PersistentDataType.INTEGER); if(itemLore.size() >= enchantLoreLength) { itemLore.subList(0, enchantLoreLength).clear(); } - meta.getPersistentDataContainer().remove(key); } } catch (NullPointerException ignored) {} - itemLore.removeIf((s -> s.startsWith(prefix))); + meta.getPersistentDataContainer().remove(key); + itemLore.removeIf((s) -> s.startsWith(prefix)); if (meta instanceof EnchantmentStorageMeta) { EnchantmentStorageMeta metaBook = (EnchantmentStorageMeta) meta;