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

Allow packet wrappers to be reusable #192

Closed retrooper closed 2 years ago

retrooper commented 2 years ago

Basically, we likely need to do some buffer retain duplication.

retrooper commented 2 years ago

We should make a method called makeResuable() or so in the wrapper to simplify this task. So users dont need to interact with netty directly.

terrarier2111 commented 2 years ago

Should the user call makeReusable before every use of the Wrapper, or only once and let them clean up the buffer's memory once they don't need it anymore or we just leave the buffer's memory lingering (this would probably be pretty bad)?

retrooper commented 2 years ago

Idek, you tell me how we do it. Just sometimes people want to send one packet wrapper to a set of users without re-encoding it each time. You know?

MWHunter commented 2 years ago

Fixed by https://github.com/retrooper/packetevents/commit/16f9eb32c9fddb911b296c33de28ac229be88eaf

It does have to re-encode it every time, but I don't trust users enough to not memory leak to give them that ability.