CloudburstMC / Protocol

A protocol library for Minecraft Bedrock Edition
https://git.io/ProtocolLib
Apache License 2.0
310 stars 96 forks source link

AvailableCommandsPacket wrong encoding #193

Closed Crasher508 closed 1 year ago

Crasher508 commented 1 year ago

Hey Guys, I use a combination of CloudburstMC/Protocol driven applications (Sever -> WaterdogPE -> ProxyPass -> Client; Server -> WaterdogPE -> DebugClient). When the Proxy handle (decode + encode) the AvailableCommandsPacket it's result wrong CommandData->aliases:

Example given:

Server -> send via Proxy without decode + encode -> DebugClient: AvailableCommandsPacket(commands=[CommandData( name=clear description=Entfernt Gegenstände aus dem Spielerinventar. flags=[] permission=0 aliases=null overloads=[ [ CommandParamData(name=args, optional=true, enumData=null, type=CommandParam(type=TEXT, defaultValue=-1), postfix=null, options=[]) ] ]
)])

Server -> send via Proxy with full decoding + encoding: AvailableCommandsPacket(commands=[CommandData( name=clear description=Entfernt Gegenstände aus dem Spielerinventar. flags=[] permission=0 aliases=CommandEnumData(name=KillAliases, values={suicide=[], kill=[]}, isSoft=false) <-- All CommandData Entries have the Alias of one CommandData Entry (it's the alias from the first CommandData with Alias) overloads=[ [ CommandParamData(name=args, optional=true, enumData=null, type=CommandParam(type=TEXT, defaultValue=-1), postfix=null, options=[]) ] ]
)])

Wrong encoding in serializer?

Crasher508 commented 1 year ago

How to fix it: Add to every CommandData entry a Alias. If their is an Alias valued "null", the Encoding/Decoding issue occures