From 437e40a2f841d969b9dd08522ee435f447c8bb62 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 4 Nov 2023 21:46:48 -0500 Subject: [PATCH] Update Paper --- gradle.properties | 2 +- ...-handling-of-invalid-JSON-components.patch | 8 +++---- .../0014-Block-server-side-chunkbans.patch | 23 ++++++++++++------- ...on-option-to-disable-chat-signatures.patch | 4 ++-- ...tch-invalid-entity-rotation-log-spam.patch | 4 ++-- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index b55220d..85fad4d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.totalfreedom.scissors version=1.20.2-R0.1-SNAPSHOT mcVersion=1.20.2 -paperRef=1865625d958b94d82e0bd601d6d860318980c4c4 +paperRef=8cafc0729775aa8321b68e10de6a3953333b1392 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/server/0013-Better-handling-of-invalid-JSON-components.patch b/patches/server/0013-Better-handling-of-invalid-JSON-components.patch index 4c578ba..78f2802 100644 --- a/patches/server/0013-Better-handling-of-invalid-JSON-components.patch +++ b/patches/server/0013-Better-handling-of-invalid-JSON-components.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Better handling of invalid JSON components diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index d02546b18cb689724887b4e85e8d32a18828a4ad..f8ffd6a52ad8c13eb13f51afe3a864cd3595d7eb 100644 +index 8240bb085b619f257f8c0a25775e0b15068e440f..c80d58dc9cb9171d51ff0a0596bb27bf161c3c83 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -655,12 +655,6 @@ public final class MCUtil { +@@ -659,12 +659,6 @@ public final class MCUtil { return null; } String string = compound.getString(key); @@ -127,10 +127,10 @@ index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a9 } }).reduce((accumulator, current) -> { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f20ae9153b7098980ce6c0e75fcbbb4da652661b..7f5b2787482f52114c62f8b9d19755f3baeaefa0 100644 +index 1e05fca2a2ba6e2c0b641b6e27585520889cd8a6..3bf0c06f5042e9ff5572714dfc6a641a01a65978 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2470,12 +2470,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2503,12 +2503,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setRot(this.getYRot(), this.getXRot()); if (nbt.contains("CustomName", 8)) { String s = nbt.getString("CustomName"); diff --git a/patches/server/0014-Block-server-side-chunkbans.patch b/patches/server/0014-Block-server-side-chunkbans.patch index ee6f6ac..87884fe 100644 --- a/patches/server/0014-Block-server-side-chunkbans.patch +++ b/patches/server/0014-Block-server-side-chunkbans.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Block server-side chunkbans diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 45b4f1c295eda2fcc5067a4b21de247218ef117f..f2e7585630ff724f966c7bcedc17e502d786870d 100644 +index d364bd57b1675c8b21d781c2bc16c3e65800455c..f2e7585630ff724f966c7bcedc17e502d786870d 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -7,8 +7,16 @@ import io.netty.handler.codec.MessageToByteEncoder; @@ -49,7 +49,7 @@ index 45b4f1c295eda2fcc5067a4b21de247218ef117f..f2e7585630ff724f966c7bcedc17e502 protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception { Attribute> attribute = channelHandlerContext.channel().attr(this.codecKey); ConnectionProtocol.CodecData codecData = attribute.get(); -@@ -34,39 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -34,46 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder> { throw new IOException("Can't serialize unregistered packet"); } else { FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); @@ -69,13 +69,17 @@ index 45b4f1c295eda2fcc5067a4b21de247218ef117f..f2e7585630ff724f966c7bcedc17e502 - JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); + k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); } catch (Throwable var13) { -- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message +- // Paper start - Give proper error message +- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName()); +- if (packetName.contains(".")) { +- packetName = packetName.substring(packetName.lastIndexOf(".") + 1); +- } +- +- LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13); +- // Paper end - if (packet.isSkippable()) { - throw new SkipPacketException(var13); -+ packet = capPacket(packet, i); -+ if (packet == null) { -+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet)); - } +- } - - throw var13; - } finally { @@ -83,7 +87,10 @@ index 45b4f1c295eda2fcc5067a4b21de247218ef117f..f2e7585630ff724f966c7bcedc17e502 - int packetLength = friendlyByteBuf.readableBytes(); - if (packetLength > MAX_PACKET_SIZE) { - throw new PacketTooLargeException(packet, this.codecKey, packetLength); -- } ++ packet = capPacket(packet, i); ++ if (packet == null) { ++ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet)); + } - // Paper end - ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + friendlyByteBuf.clear(); diff --git a/patches/server/0035-Add-configuration-option-to-disable-chat-signatures.patch b/patches/server/0035-Add-configuration-option-to-disable-chat-signatures.patch index cf1b8a7..459c50a 100644 --- a/patches/server/0035-Add-configuration-option-to-disable-chat-signatures.patch +++ b/patches/server/0035-Add-configuration-option-to-disable-chat-signatures.patch @@ -60,7 +60,7 @@ index c0a80824a0307ea673805015119cc834b268f0dc..9f28f86b1b56ea55ab39f6ac988c1f47 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 51331ad3f295b55631adcb6f47e34d0b03bd148a..19f573a1f62280bd9b67a4027962fcb7de6d2514 100644 +index 250d2383d7df9584e52a9600b0ac89f96ba7002d..cecd2bafc30650d4b7720571bcd127c943214a4f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ @@ -95,7 +95,7 @@ index 51331ad3f295b55631adcb6f47e34d0b03bd148a..19f573a1f62280bd9b67a4027962fcb7 ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes } -@@ -3455,6 +3458,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3461,6 +3464,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch index cd2b1bf..c576422 100644 --- a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Patch invalid entity rotation log spam diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7f5b2787482f52114c62f8b9d19755f3baeaefa0..759ca876613e334805aa041f049b2f556a0e92a2 100644 +index 3bf0c06f5042e9ff5572714dfc6a641a01a65978..240d845ff72ec15657ff648a9b18b86eeb696215 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4658,7 +4658,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4670,7 +4670,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void setXRot(float pitch) { if (!Float.isFinite(pitch)) {