From 2cef1cc67e549b6bcafee5eaf94ff6b2184bcef1 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Sat, 4 Nov 2023 20:34:34 +0100 Subject: [PATCH] Include packet class name in packet encoding error messages (#9907) --- ...ktraces-in-log-messages-crash-report.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch index 127452112a..5b8d2b6d60 100644 --- a/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -523,6 +523,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet packet) { +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder> { + + JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); + } 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); + } diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java