Added support for gradients / formatting in type colors
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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: "<gradient:f953c6>{}</gradient:b91d73>"
|
||||
artifact-color: "&e"
|
||||
spell-color: "&9"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user