[5.0] receiveClientPacket broke API compatibility, and is also broken itself
bergerkiller opened this issue · 5 comments
Describe the bug
ProtocolLib 5.0 removed the old (typo'd) recieveClientPacket and replaced it with receiveClientPacket, which has an extra boolean parameter. While trying to work around this issue I now find that the new method throws an UnsupportedOperationException when called.
Exception: https://paste.traincarts.net/uvafakocaf.php
To Reproduce
Steps to reproduce the behavior:
- Install BKCommonLib from here ( https://ci.mg-dev.eu/job/BKCommonLib/1268/ )
- Install Traincarts and TC-Coasters
- Go near to a TCC node and left-click to select it
- TCC cancels the original packets and enqueues a different interaction packet instead (to prevent nodes' invisible entities breaking block breaking nearby)
- ProtocolLib throws an exception: https://paste.traincarts.net/uvafakocaf.php
Expected behavior
No exception.
Version Info
https://paste.traincarts.net/nunoderiji.pl
Additional context
In case this was due to calling it while handling the send of another packet, I also tried calling that method in a next-tick task. The same happened, so this isnt the cause here. ( https://paste.traincarts.net/ibaqogeyiz.m )
Code involves at-runtime generated code. But the basics boil down to this small adaptor snippet being called from receivePacket() further down below. https://github.com/bergerhealer/BKCommonLib/blob/master/src/main/java/com/bergerkiller/bukkit/common/internal/network/ProtocolLibPacketHandler.java#L85
Player player = ...
Object packet = ...
PacketContainer toReceive = new PacketContainer(PacketRegistry.getPacketType(packet.getClass()), packet);
ProtocolLibrary.getProtocolManager().receiveClientPacket(player, toReceive, true);
Can you link a jar to test that commit so I can give those changes a test too? :)
Works great, no errors, and looks like the packet is handled correctly when I click at the entity. Of course the async listener issue is still there but I assume one jar only contains the fixes of one PR at a time.