Fix component to builder + bump Adventure API version (except in Paper because it’s still using 4.7.0)

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

View File

@ -32,7 +32,7 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId> <artifactId>adventure-api</artifactId>
<version>4.7.0</version> <version>4.8.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
@ -42,7 +42,7 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-plain</artifactId> <artifactId>adventure-text-serializer-plain</artifactId>
<version>4.7.0</version> <version>4.8.1</version>
</dependency> </dependency>

View File

@ -396,7 +396,7 @@ public abstract class Chat extends ChatStatic implements HoverEventSource<Compon
else { else {
throw new IllegalArgumentException("Unknows component type " + c.getClass()); throw new IllegalArgumentException("Unknows component type " + c.getClass());
} }
return builder.style(c.style()); return builder.style(c.style()).append(c.children());
} }

View File

@ -4,6 +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.format.NamedTextColor;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
@ -78,4 +80,18 @@ public abstract class ChatStatic {
public static FormatableChat score(String name, String objective) { public static FormatableChat score(String name, String objective) {
return chatComponent(Component.score(name, objective)); return chatComponent(Component.score(name, objective));
} }
// public static void main(String[] args) {
// for (Chat c : new Chat[] {
// chat(),
// text("toto").color(NamedTextColor.GRAY),
// legacyText("tot§9o").color(NamedTextColor.GRAY),
// }) {
// System.out.println(GsonComponentSerializer.gson().serialize(c.getAdv()));
// }
// }
} }