From 3616aa07fe22cbc1be17ad0eb5ca69b72601c72e Mon Sep 17 00:00:00 2001 From: rtm516 Date: Mon, 13 Apr 2020 22:29:22 +0100 Subject: [PATCH] Fixed colour and style formatting for some messages --- .../org/geysermc/connector/utils/MessageUtils.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java index a28d6a7a..b47e86ee 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MessageUtils.java @@ -58,7 +58,7 @@ public class MessageUtils { strings.add(" - no permission or invalid command!"); } - List furtherParams = getTranslationParams(translation.getTranslationParams()); + List furtherParams = getTranslationParams(translation.getTranslationParams(), locale); if (locale != null) { strings.add(insertParams(LocaleUtils.getLocaleString(translation.getTranslationKey(), locale), furtherParams)); }else{ @@ -96,7 +96,11 @@ public class MessageUtils { messageText = LocaleUtils.getLocaleString(messageText, locale); } - StringBuilder builder = new StringBuilder(messageText); + StringBuilder builder = new StringBuilder(); + builder.append(getFormat(message.getStyle().getFormats())); + builder.append(getColorOrParent(message.getStyle())); + builder.append(messageText); + for (Message msg : message.getExtra()) { builder.append(getFormat(msg.getStyle().getFormats())); builder.append(getColorOrParent(msg.getStyle())); @@ -139,8 +143,8 @@ public class MessageUtils { private static String getColorOrParent(MessageStyle style) { ChatColor chatColor = style.getColor(); - if (chatColor == ChatColor.NONE) { - return getColor(style.getParent().getColor()); + if (chatColor == ChatColor.NONE && style.getParent() != null) { + return getColorOrParent(style.getParent()); } return getColor(chatColor);