Add ASM dep to API and fix issues from title packet changes with bungee api

This commit is contained in:
Jason Penilla
2021-06-11 19:23:18 -07:00
parent 51d9594fe8
commit 25eea26621
2 changed files with 19 additions and 4 deletions

View File

@@ -5,6 +5,19 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods. Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies {
api("net.kyori:adventure-text-serializer-gson")
api("net.kyori:adventure-text-serializer-legacy")
api("net.kyori:adventure-text-serializer-plain")
+ api("org.ow2.asm:asm:9.0")
+ api("org.ow2.asm:asm-commons:9.0")
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/pom.xml --- a/pom.xml

View File

@@ -76,12 +76,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) { + public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) {
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.TIMES, (BaseComponent[]) null, fadeInTicks, stayTicks, fadeOutTicks)); + getHandle().connection.send(new ClientboundSetTitlesAnimationPacket(fadeInTicks, stayTicks, fadeOutTicks));
+ } + }
+ +
+ @Override + @Override
+ public void setSubtitle(BaseComponent[] subtitle) { + public void setSubtitle(BaseComponent[] subtitle) {
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.SUBTITLE, subtitle, 0, 0, 0)); + final String json = net.md_5.bungee.chat.ComponentSerializer.toString(subtitle);
+ getHandle().connection.send(new ClientboundSetSubtitleTextPacket(Component.Serializer.fromJson(json)));
+ } + }
+ +
+ @Override + @Override
@@ -91,7 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public void showTitle(BaseComponent[] title) { + public void showTitle(BaseComponent[] title) {
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.TITLE, title, 0, 0, 0)); + final String json = net.md_5.bungee.chat.ComponentSerializer.toString(title);
+ getHandle().connection.send(new ClientboundSetTitleTextPacket(Component.Serializer.fromJson(json)));
+ } + }
+ +
+ @Override + @Override
@@ -133,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public void hideTitle() { + public void hideTitle() {
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.CLEAR, (BaseComponent[]) null, 0, 0, 0)); + getHandle().connection.send(new ClientboundClearTitlesPacket(false));
+ } + }
+ // Paper end + // Paper end
+ +