Describe the bug
First of all you need to check outPackets, because packets is never updated.
|
if (packets.iterator().hasNext()) { |
Secondly BundlePacket instance can be shared between multiple players, so i think you need to swap old BundlePacket instance with new one if some plugin changes handle or cancels any of inner packets. If one plugin cancels some inner packets for one players, it may not want to cancel that same packet for other player in case of shared BundlePacket instance.
paper 1.21.11 code:

Leaf fork for example uses shared instances in more places.
And last one, for performance purposes i think its better to copy inner packets only if some plugin actually do something what requires copying (cancelling or using event#setPacket(newContainer) or null inner packet) in other cases it just waste of resourses. I think you can check if Iterable is RandomAccess and create 2 execution pathes -one with lazy init + indexing tracking, second is always copying while iterating.
To Reproduce
Expected behavior
Screenshots
Version Info
Additional context
Describe the bug
First of all you need to check
outPackets, becausepacketsis never updated.ProtocolLib/src/main/java/com/comphenix/protocol/injector/collection/OutboundPacketListenerSet.java
Line 61 in f606cc9
Secondly

BundlePacketinstance can be shared between multiple players, so i think you need to swap oldBundlePacketinstance with new one if some pluginchanges handleorcancelsany of inner packets. If one plugin cancels some inner packets for one players, it may not want to cancel that same packet for other player in case of sharedBundlePacketinstance.paper 1.21.11 code:
Leaf fork for example uses shared instances in more places.
And last one, for performance purposes i think its better to copy inner packets only if some plugin actually do something what requires copying (cancelling or using event#setPacket(newContainer) or null inner packet) in other cases it just waste of resourses. I think you can check if
IterableisRandomAccessand create 2 execution pathes -one with lazy init + indexing tracking, second is always copying while iterating.To Reproduce
Expected behavior
Screenshots
Version Info
Additional context