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 8a141129..15882617 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 @@ -3,6 +3,7 @@ package com.willfp.ecoenchants.display; import com.google.common.collect.ImmutableMap; import com.willfp.eco.core.config.updating.ConfigUpdater; import com.willfp.eco.core.display.Display; +import com.willfp.eco.util.StringUtils; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; @@ -107,12 +108,12 @@ public class EnchantmentCache { } else { description = Arrays.asList( WordUtils.wrap( - String.valueOf(PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description")), + PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description"), PLUGIN.getConfigYml().getInt("lore.describe.wrap"), "\n", false ).split("\\r?\\n") ); - name = String.valueOf(PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name")); + name = PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"); type = enchantment.isCursed() ? EnchantmentType.CURSE : EnchantmentType.NORMAL; if (enchantment.isTreasure()) { rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-treasure-rarity")); @@ -132,7 +133,11 @@ public class EnchantmentCache { } String rawName = name; - name = color + name; + if (color.contains("{}")) { + name = StringUtils.format(color.replace("{}", name)); + } else { + name = color + name; + } description.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line); CACHE.put(enchantment.getKey(), new CacheEntry(enchantment, name, rawName, description, type, rarity)); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java index fca04b56..a1043362 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java @@ -34,7 +34,7 @@ public class EnchantmentType { public static final EnchantmentType NORMAL = new EnchantmentType( "normal", false, - () -> PLUGIN.getLangYml().getString("not-curse-color") + () -> PLUGIN.getLangYml().getString("normal-color", false) ); /** @@ -45,7 +45,7 @@ public class EnchantmentType { public static final EnchantmentType CURSE = new EnchantmentType( "curse", false, - () -> PLUGIN.getLangYml().getString("curse-color") + () -> PLUGIN.getLangYml().getString("curse-color", false) ); /** @@ -56,7 +56,7 @@ public class EnchantmentType { public static final EnchantmentType SPECIAL = new EnchantmentType( "special", () -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"), - () -> PLUGIN.getLangYml().getString("special-color") + () -> PLUGIN.getLangYml().getString("special-color", false) ); /** @@ -67,7 +67,7 @@ public class EnchantmentType { public static final EnchantmentType ARTIFACT = new EnchantmentType( "artifact", () -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"), - () -> PLUGIN.getLangYml().getString("artifact-color"), + () -> PLUGIN.getLangYml().getString("artifact-color", false), Artifact.class ); @@ -79,7 +79,7 @@ public class EnchantmentType { public static final EnchantmentType SPELL = new EnchantmentType( "spell", true, - () -> PLUGIN.getLangYml().getString("spell-color"), + () -> PLUGIN.getLangYml().getString("spell-color", false), Spell.class ); diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index 88c08a99..344b243c 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -35,8 +35,8 @@ no-targets: "&cCannot be applied" no-conflicts: "&cNo conflicts" curse-color: "&c" -not-curse-color: "&7" -special-color: "&d" +normal-color: "&7" +special-color: "{}" artifact-color: "&e" spell-color: "&9"