diff --git a/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/src/main/java/com/gmail/nossr50/chat/ChatManager.java index b8c25d11e..ae6499583 100644 --- a/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -13,7 +13,6 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.text.StringUtils; import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import org.bukkit.command.ConsoleCommandSender; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java b/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java index ea317d487..7cc36eee7 100644 --- a/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java +++ b/src/main/java/com/gmail/nossr50/chat/author/AbstractPlayerAuthor.java @@ -39,7 +39,7 @@ public abstract class AbstractPlayerAuthor implements Author { return componentDisplayName; } else { //convert to adventure component - componentDisplayName = TextUtils.ofBungeeRawStrings(displayName); + componentDisplayName = TextUtils.ofLegacyTextRaw(displayName); } return componentDisplayName; } @@ -56,7 +56,7 @@ public abstract class AbstractPlayerAuthor implements Author { return componentUserName; } else { //convert to adventure component - componentUserName = TextUtils.ofBungeeRawStrings(player.getName()); + componentUserName = TextUtils.ofLegacyTextRaw(player.getName()); } return componentUserName; } diff --git a/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java b/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java index 644657df8..7886bc5cc 100644 --- a/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java +++ b/src/main/java/com/gmail/nossr50/chat/mailer/AdminChatMailer.java @@ -54,9 +54,9 @@ public class AdminChatMailer extends AbstractChatMailer { */ public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) { if(canColor) { - return TextUtils.ofBungeeRawStrings(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), LocaleLoader.addColors(message))); + return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), LocaleLoader.addColors(message))); } else { - return TextUtils.ofBungeeRawStrings(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message)); + return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message)); } } diff --git a/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java b/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java index 5b69edeef..603934ee1 100644 --- a/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java +++ b/src/main/java/com/gmail/nossr50/chat/mailer/PartyChatMailer.java @@ -50,9 +50,9 @@ public class PartyChatMailer extends AbstractChatMailer { } if(isLeader) { - return TextUtils.ofBungeeRawStrings(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message)); + return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message)); } else { - return TextUtils.ofBungeeRawStrings(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message)); + return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message)); } } diff --git a/src/main/java/com/gmail/nossr50/chat/message/AbstractChatMessage.java b/src/main/java/com/gmail/nossr50/chat/message/AbstractChatMessage.java index 5015be0c0..5eeb889e4 100644 --- a/src/main/java/com/gmail/nossr50/chat/message/AbstractChatMessage.java +++ b/src/main/java/com/gmail/nossr50/chat/message/AbstractChatMessage.java @@ -1,10 +1,8 @@ package com.gmail.nossr50.chat.message; import com.gmail.nossr50.chat.author.Author; -import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.google.common.base.Objects; import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/gmail/nossr50/chat/message/ChatMessage.java b/src/main/java/com/gmail/nossr50/chat/message/ChatMessage.java index c4c0264cf..45bc1ac18 100644 --- a/src/main/java/com/gmail/nossr50/chat/message/ChatMessage.java +++ b/src/main/java/com/gmail/nossr50/chat/message/ChatMessage.java @@ -1,9 +1,7 @@ package com.gmail.nossr50.chat.message; import com.gmail.nossr50.chat.author.Author; -import com.gmail.nossr50.datatypes.chat.ChatChannel; import net.kyori.adventure.audience.Audience; -import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/gmail/nossr50/chat/message/PartyChatMessage.java b/src/main/java/com/gmail/nossr50/chat/message/PartyChatMessage.java index 2dee5c2e6..3c957d483 100644 --- a/src/main/java/com/gmail/nossr50/chat/message/PartyChatMessage.java +++ b/src/main/java/com/gmail/nossr50/chat/message/PartyChatMessage.java @@ -46,7 +46,7 @@ public class PartyChatMessage extends AbstractChatMessage { //Sends to everyone but console audience.sendMessage(author, componentMessage); - TextComponent spyMessage = TextUtils.ofBungeeRawStrings(LocaleLoader.getString("Chat.Spy.Party", author.getAuthoredName(ChatChannel.PARTY), rawMessage, party.getName())); + TextComponent spyMessage = TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Spy.Party", author.getAuthoredName(ChatChannel.PARTY), rawMessage, party.getName())); //Relay to spies messagePartyChatSpies(spyMessage); diff --git a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java index 7007d7f1d..865105eb1 100644 --- a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java +++ b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java @@ -6,6 +6,7 @@ import net.kyori.adventure.text.ComponentBuilder; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.md_5.bungee.api.chat.BaseComponent; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -98,4 +99,8 @@ public class TextUtils { public static @NotNull TextComponent ofBungeeRawStrings(@NotNull String bungeeRawString) { return ofBungeeComponents(convertToBungeeComponent(bungeeRawString)); } + + public static @NotNull TextComponent ofLegacyTextRaw(@NotNull String rawString) { + return LegacyComponentSerializer.legacySection().deserialize(rawString); + } }