mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Use legacy serializer instead
This commit is contained in:
parent
0f15f234b5
commit
bd48680125
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user