mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-03-01 15:51:03 +01:00
<tier-name> fixed
This commit is contained in:
parent
077a4ce0ef
commit
5ed21155ea
@ -32,11 +32,12 @@ public class DisplayName extends StringStat implements GemStoneStat {
|
|||||||
|
|
||||||
// Bake
|
// Bake
|
||||||
String format = data.toString()
|
String format = data.toString()
|
||||||
.replace("<tier-name>", tier != null ? ChatColor.stripColor(tier.getName()) : "")
|
.replace("<tier-name>", tier != null ? ColorUtils.stripColors(tier.getName()) : "")
|
||||||
.replace("<tier-color>", tier != null ? ChatColor.getLastColors(tier.getName()) : "&f")
|
.replace("<tier-color>", tier != null ? ChatColor.getLastColors(tier.getName()) : "&f")
|
||||||
.replace("<tier-color-cleaned>", tier != null ? ColorUtils.stripDecoration(ChatColor.getLastColors(tier.getName())) : "&f");
|
.replace("<tier-color-cleaned>", tier != null ? ColorUtils.stripDecoration(ChatColor.getLastColors(tier.getName())) : "&f");
|
||||||
|
|
||||||
if (tier != null) {
|
if (tier != null) {
|
||||||
|
System.out.println("Name: " + tier.getName());
|
||||||
System.out.println("Format: " + format);
|
System.out.println("Format: " + format);
|
||||||
System.out.println("Last Colors: " + ChatColor.getLastColors(tier.getName()) + " w: " + ColorUtils.stripDecoration(ChatColor.getLastColors(tier.getName())));
|
System.out.println("Last Colors: " + ChatColor.getLastColors(tier.getName()) + " w: " + ColorUtils.stripDecoration(ChatColor.getLastColors(tier.getName())));
|
||||||
System.out.println("===================\n");
|
System.out.println("===================\n");
|
||||||
|
@ -14,8 +14,13 @@ import java.util.regex.Pattern;
|
|||||||
public class ColorUtils {
|
public class ColorUtils {
|
||||||
|
|
||||||
private static final Pattern STRIP_DECORATION_PATTERN = Pattern.compile("(?i)" + '§' + "[K-O]");
|
private static final Pattern STRIP_DECORATION_PATTERN = Pattern.compile("(?i)" + '§' + "[K-O]");
|
||||||
|
private static final Pattern COLOR_TAG_PATTERN = Pattern.compile("(?i)<.*>");
|
||||||
|
|
||||||
public static @NotNull String stripDecoration(@NotNull String input) {
|
public static @NotNull String stripDecoration(@NotNull String input) {
|
||||||
return "%s%s".formatted(ChatColor.RESET, STRIP_DECORATION_PATTERN.matcher(input).replaceAll("")).replace('§', '&');
|
return "%s%s".formatted(ChatColor.RESET, STRIP_DECORATION_PATTERN.matcher(input).replaceAll("")).replace('§', '&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @NotNull String stripColors(@NotNull String input) {
|
||||||
|
return ChatColor.stripColor(COLOR_TAG_PATTERN.matcher(input).replaceAll(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user