Change legacy serializer, maybe the Bungee one is not working with new API

This commit is contained in:
Marc Baloup 2021-07-20 00:19:17 +02:00
parent 2e334af7a1
commit fe47812551
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893
2 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ public abstract class Chat extends ChatStatic implements HoverEventSource<Compon
} }
public String getLegacyText() { public String getLegacyText() {
return LegacyComponentSerializer.legacySection().serializeOr(getAdv(), ""); return LegacyComponentSerializer.legacySection().serialize(getAdv());
} }
public String getPlainText() { public String getPlainText() {

View File

@ -4,8 +4,8 @@ import java.util.Objects;
import fr.pandacube.lib.core.chat.Chat.FormatableChat; import fr.pandacube.lib.core.chat.Chat.FormatableChat;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
public abstract class ChatStatic { public abstract class ChatStatic {
@ -32,7 +32,7 @@ public abstract class ChatStatic {
} }
public static FormatableChat legacyText(Object legacyText) { public static FormatableChat legacyText(Object legacyText) {
return chatComponent(TextComponent.fromLegacyText(Objects.toString(legacyText), null)); return chatComponent(LegacyComponentSerializer.legacySection().deserialize(Objects.toString(legacyText)));
} }
public static FormatableChat infoText(Object plainText) { public static FormatableChat infoText(Object plainText) {