ProtocolLib

3M Downloads

Field with type byte in PacketPlayOutChat

AlonsoAliaga opened this issue ยท 3 comments

commented

Describe the bug
Everything seems fine, but trying to send action bar as in other versions throws error.

To Reproduce
Steps to reproduce the behavior:

  1. Use code:
    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); PacketContainer chatPacket = protocolManager.createPacket(PacketType.Play.Server.CHAT); chatPacket.getChatComponents().write(0, WrappedChatComponent.fromText(message)); chatPacket.getBytes().write(0, (byte) 2); try { protocolManager.sendServerPacket(player, chatPacket); } catch (InvocationTargetException e) {}
  2. Run it
  3. Error in console:
    Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type byte exists in class PacketPlayOutChat. at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:363) ~[?:?] at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:343) ~[?:?]

Expected behavior
Send actionbar. But its saying that it doesnt exists byte type in PacketPlayOutChat, i've used it before.

Screenshots
None

Version Info
https://hastebin.com/ofuhufazek

Additional context
Nothing

commented

It's a ChatType now, use packet.getChatTypes()

commented

Oh, its working now. That means i need to use that from now on? I mean for 1.8 - 1.15 using ProtocolLib 4.5.0? (latest) or i still need to use byte when using 1.8?

commented

the protocol changes for different versions, you need to use whatever is right for your mc version