From 47cc339b7d0d886068c27f75f779a1df2658f515 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 31 Jul 2021 17:03:48 +0100 Subject: [PATCH] Added {} formatting support to custom rarity colors --- .../com/willfp/ecoenchants/display/EnchantmentCache.java | 7 ++++--- .../ecoenchants/enchantments/meta/EnchantmentRarity.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java index 8582006e..674a637e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java @@ -124,14 +124,15 @@ public class EnchantmentCache { color = type.getColor(); - if (rarity != null && rarity.hasCustomColor() && type != EnchantmentType.CURSE) { - color = rarity.getCustomColor(); - } if (rarity == null) { rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")); } + if (rarity.hasCustomColor() && type != EnchantmentType.CURSE) { + color = rarity.getCustomColor(); + } + String rawName = name; if (color.contains("{}")) { name = color.replace("{}", name); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java index bc5b8229..cc5a248e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java @@ -105,7 +105,7 @@ public class EnchantmentRarity { double lootProbability = rarityYml.getDouble("rarities." + rarity + ".loot-probability"); String customColor = null; if (rarityYml.getBool("rarities." + rarity + ".custom-color.enabled")) { - customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color"); + customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color", false); } new EnchantmentRarity(rarity, probability, minimumLevel, villagerProbability, lootProbability, customColor).register();