mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Fix deprecated bungee APIs still serializing to JSON in packets (#10028)
This commit is contained in:
parent
28abbaa7bd
commit
82f9280ae4
@ -5,21 +5,22 @@ Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index bc7d0cc8d66f07b45cffd9952829cc9bed9ce260..00beadec2ad995d724758d051457a3d780d9d813 100644
|
||||
index bc7d0cc8d66f07b45cffd9952829cc9bed9ce260..3374ea2fa61e1683c4c4d7ea3ef9b8a20cd09f62 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -532,6 +532,11 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -538,6 +538,12 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
// TODO this.adventure$locale
|
||||
return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.CODEC, io.papermc.paper.adventure.PaperAdventure.asVanilla(component));
|
||||
return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.CODEC, text);
|
||||
}
|
||||
+
|
||||
+ // Paper start - deprecated Tab List & Title APIs
|
||||
+ @Deprecated
|
||||
+ public FriendlyByteBuf writeComponent(final net.md_5.bungee.api.chat.BaseComponent[] component) {
|
||||
+ return this.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(component), 262144);
|
||||
+ return this.writeComponent(java.util.Objects.requireNonNull(Component.Serializer.fromJson(net.md_5.bungee.chat.ComponentSerializer.toString(component))));
|
||||
+ }
|
||||
// Paper end
|
||||
+ // Paper end - deprecated Tab List & Title APIs
|
||||
|
||||
public FriendlyByteBuf writeComponent(Component text) {
|
||||
public <T extends Enum<T>> T readEnum(Class<T> enumClass) {
|
||||
return ((T[]) enumClass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
|
||||
index e77bd5bb66279f579fad4fdcc8b0606410922e9e..4c05fee93eb20044a4198c43d5ae1eebebaabaf7 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java
|
||||
@ -63,7 +64,7 @@ index 7bb08db97c324d13836303cc8a4623c71d6c8a2c..5e9045f7722481e1f83a3d36d7b3d86e
|
||||
// Paper end
|
||||
buf.writeComponent(this.text);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 445e1349256a788a59831893ba7238ae95ae6bef..136dd30ae472a58845a2d8f399d2040faed09345 100644
|
||||
index 7b0e382d1c31ee63cd1b1ccbf7f2fc7dda78fe9c..268e524550f76b77b12c808c682d5416f802d98e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary itemmeta handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 00beadec2ad995d724758d051457a3d780d9d813..ff794499df6a2b65db2ca5956d2b98317592057f 100644
|
||||
index 3374ea2fa61e1683c4c4d7ea3ef9b8a20cd09f62..23d78a3193c30dd99d42182628c0e9e4527fc143 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -641,7 +641,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -642,7 +642,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
|
||||
// Spigot start - filter
|
||||
stack = stack.copy();
|
||||
@ -17,7 +17,7 @@ index 00beadec2ad995d724758d051457a3d780d9d813..ff794499df6a2b65db2ca5956d2b9831
|
||||
// Spigot end
|
||||
nbttagcompound = stack.getTag();
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -663,7 +663,7 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
|
||||
itemstack.setTag(this.readNbt());
|
||||
// CraftBukkit start
|
||||
|
Loading…
Reference in New Issue
Block a user