Update Paper

This commit is contained in:
Telesphoreo 2023-11-04 21:36:47 -05:00
parent cbd4b8c045
commit 5e8dbab98c
5 changed files with 24 additions and 17 deletions

View file

@ -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

View file

@ -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");

View file

@ -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<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
ConnectionProtocol.CodecData<?> codecData = attribute.get();
@@ -34,39 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
@@ -34,46 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
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();

View file

@ -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());

View file

@ -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)) {