mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-07-01 08:54:57 +02:00
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: c92581d0 #3556: Deserialize arrays to single components e442c3da #3546: Add string length checks to isValidName f903c54d #3554: Bump org.apache.maven.plugins:maven-checkstyle-plugin 0d453789 #3540: Add TextComponent#fromLegacy() as an array-free alternative to #fromLegacyText() 0f5f09b6 Minecraft 23w43b support e5c80d00 Fix code formatting 9cdb2ba3 Deprecate exposed scoreboard API d0e5cf7c #3549: Bump io.netty:netty-bom from 4.1.99.Final to 4.1.100.Final c8568764 Fix writing non-compound root NBT tags
58 lines
2.5 KiB
Diff
58 lines
2.5 KiB
Diff
From 05898ba911116042aadf6c154f4f6c39b3234b36 Mon Sep 17 00:00:00 2001
|
|
From: Techcable <Techcable@techcable.net>
|
|
Date: Thu, 4 Aug 2016 19:30:49 -0700
|
|
Subject: [PATCH] Dump the raw hex of a packet on a decoding error
|
|
|
|
|
|
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
index 250e7620..2207c3ff 100644
|
|
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
|
|
@@ -1,7 +1,9 @@
|
|
package net.md_5.bungee.protocol;
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
+import io.netty.buffer.ByteBufUtil;
|
|
import io.netty.channel.ChannelHandlerContext;
|
|
+import io.netty.handler.codec.DecoderException;
|
|
import io.netty.handler.codec.MessageToMessageDecoder;
|
|
import java.util.List;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -40,13 +42,16 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
|
Protocol.DirectionData prot = ( server ) ? protocol.TO_SERVER : protocol.TO_CLIENT;
|
|
ByteBuf slice = in.copy(); // Can't slice this one due to EntityMap :(
|
|
|
|
+ Object packetTypeInfo = null;
|
|
try
|
|
{
|
|
int packetId = DefinedPacket.readVarInt( in );
|
|
+ packetTypeInfo = packetId;
|
|
|
|
DefinedPacket packet = prot.createPacket( packetId, protocolVersion, supportsForge );
|
|
if ( packet != null )
|
|
{
|
|
+ packetTypeInfo = packet.getClass();
|
|
packet.read( in, protocol, prot.getDirection(), protocolVersion );
|
|
|
|
if ( in.isReadable() )
|
|
@@ -60,6 +65,16 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
|
|
|
out.add( new PacketWrapper( packet, slice, protocol ) );
|
|
slice = null;
|
|
+ } catch (BadPacketException | IndexOutOfBoundsException e) {
|
|
+ final String packetTypeStr;
|
|
+ if (packetTypeInfo instanceof Integer) {
|
|
+ packetTypeStr = "id " + Integer.toHexString((Integer) packetTypeInfo);
|
|
+ } else if (packetTypeInfo instanceof Class) {
|
|
+ packetTypeStr = "class " + ((Class) packetTypeInfo).getSimpleName();
|
|
+ } else {
|
|
+ packetTypeStr = "unknown";
|
|
+ }
|
|
+ throw new DecoderException("Error decoding packet " + packetTypeStr + " with contents:\n" + ByteBufUtil.prettyHexDump(slice), e);
|
|
} finally
|
|
{
|
|
if ( slice != null )
|
|
--
|
|
2.42.0
|
|
|