Skip to content

Bundle packets are handled incorrectly #3596

Description

@Leymooo
  • This issue is not solved in a development build

Describe the bug
First of all you need to check outPackets, because packets is never updated.

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:
Image
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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions