aadnk / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
288 stars 92 forks source link

Enhancement to log full packet payload #124

Closed vbisbest closed 7 years ago

vbisbest commented 7 years ago

It would be super helpful if there was an option to log the full packet in hex. For instance a custom_payload packet shows as:

[ProtocolLib] Sent PacketPlayOutCustomPayload[24, legacy: 63] to xxx: { a = "REGISTER", b = { a = "UnpooledHeapByteBuf(ridx: 0, widx: 12, cap: 12/12)" } }`

I need to know what is in "unpooledHeapByteBuf". A dump of the full packet bytes in hex would answer that question.

Thank you for your consideration!

dmulloy2 commented 7 years ago

You could use this ByteBufUtil method: https://netty.io/4.0/api/io/netty/buffer/ByteBufUtil.html#hexDump(io.netty.buffer.ByteBuf)

vbisbest commented 7 years ago

Thanks @dmulloy2 . I am a bit of a noob at this, can explain how to use that? Are you saying I need to create a plugin and use that class to grab the bytes? Or are you saying that there is already a way to do this via a config setting for protocollib?

dmulloy2 commented 7 years ago

Yeah you'd have to add that call in a debugging plugin