Added {} formatting support to custom rarity colors

This commit is contained in:
Auxilor 2021-07-31 17:03:48 +01:00
parent 9c6f2706ae
commit 47cc339b7d
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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();