diff --git a/pom.xml b/pom.xml index f53b5d9..931c750 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.lunadeer MiniPlayerTitle - 4.2.5 + 4.2.6 jar MiniPlayerTitle diff --git a/src/main/java/cn/lunadeer/miniplayertitle/dtos/TitleDTO.java b/src/main/java/cn/lunadeer/miniplayertitle/dtos/TitleDTO.java index fe7ed76..59f01c7 100644 --- a/src/main/java/cn/lunadeer/miniplayertitle/dtos/TitleDTO.java +++ b/src/main/java/cn/lunadeer/miniplayertitle/dtos/TitleDTO.java @@ -74,9 +74,11 @@ public class TitleDTO { } public TextComponent getTitleColored() { - String title = MiniPlayerTitle.config.getPrefix() + this.title + MiniPlayerTitle.config.getSuffix(); - String[] parts = title.split("&#"); + TextComponent prefix = Component.text(MiniPlayerTitle.config.getPrefix(), new Color("#ffffff").getStyle()); + TextComponent suffix = Component.text(MiniPlayerTitle.config.getSuffix(), new Color("#ffffff").getStyle()); + String[] parts = this.title.split("&#"); List components = new ArrayList<>(); + components.add(prefix); for (String part : parts) { if (part.isEmpty()) { continue; @@ -92,6 +94,7 @@ public class TitleDTO { } components.add(Component.text(content, color.getStyle())); } + components.add(suffix); TextComponent.Builder title_component = Component.text(); for (TextComponent component : components) { title_component.append(component); @@ -107,7 +110,7 @@ public class TitleDTO { * @return String */ public String getTitleColoredBukkit() { - String title = MiniPlayerTitle.config.getPrefix() + this.title + MiniPlayerTitle.config.getSuffix(); + String title = "&f" + MiniPlayerTitle.config.getPrefix() + this.title + "&f" + MiniPlayerTitle.config.getSuffix(); title = title.replaceAll("&#", "#"); Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}"); Matcher matcher = pattern.matcher(title);