retrooper / packetevents

PacketEvents is emerging as a strong contender in the realm of Minecraft packet processing libraries. Designed to simplify packet manipulation while delivering high performance, this powerful tool aims to demystify the complexities of projects utilizing packets.
GNU General Public License v3.0
513 stars 148 forks source link

Somehow add support for packet listeners that want to process events away from the netty threads #193

Closed retrooper closed 2 years ago

retrooper commented 2 years ago

This might be tough to do efficiently

retrooper commented 2 years ago

We might scratch this. Still thinking

retrooper commented 2 years ago

Note: As of now, the wrappers have to be instantiated on the netty-threads. (Actually processes/reads the buffer) The data in the wrapper can be read later. Doing this automatically for each packet, would not be ideal. Some packets like outgoing chat message are quite large, and it would be unpleasant to redundantly process it, when it might not even be used.

retrooper commented 2 years ago

Regarding this, we could consider storing the buffer for later usage via retainedDuplicate, and once we are done with it, release it. Maybe make a new listener type (probably not), preferable a new setting in listeners, should be off by default as its just extra memory.

retrooper commented 2 years ago

Achieved by https://github.com/retrooper/packetevents/commit/62ac36d436a8c723b1e92174cb4f95bd8e5c879e