ProtocolLib

3M Downloads

FieldAccessException "flags" field of type byte in Play.Server.Abilities cannot be accessed in my plugin?

TheRealWHfan opened this issue ยท 1 comments

commented

Describe the bug

The byte field in play.server.abilities through packetcontainer.getBytes doesn't exist when it should in my custom plugin. I expected it to write the new byte into the packet instead of giving an error as the flags field exists on https://wiki.vg/Protocol#Player_Abilities_.28clientbound.29

To Reproduce
Steps to reproduce the behavior:

  1. Run a server with protocollib and your own plugin
  2. Run 3 lines of the following code anywhere in your plugin:

Screen Shot 2022-04-08 at 1 24 27 pm

3. See the error:

Screen Shot 2022-04-08 at 1 17 46 pm

Version Info:
https://pastebin.com/xTF5tZqN

Additional context
The flags field exists when listening to packets being sent to cilent.

commented

The encoding documented on wiki.vg does not always match how the Minecraft internally stores the packet data. In this case, the byte flag is decoded into different booleans. With ProtocolLib, you can only access the fields of the corresponding Packet class, e.g. PacketPlayOutAbilities / ClientboundPlayerAbilitiesPacket in this case. In 1.19.4, it contains the following field:
image