HypixelDev / ModAPI

Hypixel Mod API for interfacing with the Hypixel Server via the Minecraft Plugin Message system.
MIT License
83 stars 10 forks source link

Cannot subscribe to event packets more than once #30

Closed mdashlw closed 5 months ago

mdashlw commented 5 months ago

HypixelModAPI#subscribeToEventPacket cannot be called more than once ever for the same packet, because it adds it to subscribedEvents which is never cleared.

This is an issue because the player can reconnect to Hypixel, in which case it'd not be possible to subscribe to event packets again unless you send ServerboundRegisterPacket manually.

Potential solution could be to provide a method to clear subscribedEvents and lastSubscribedEvents, which could be then called upon FMLNetworkEvent.ClientDisconnectionFromServerEvent.

ConnorLinfoot commented 5 months ago

You shouldn't need to call the subscribe method for the same event, the implementation of the Mod API deals with automatically sending the registration upon receiving the hello packet, so leaving and rejoining the server doesn't present an issue.

mdashlw commented 5 months ago

I see. I did not expect there to be built-in packet handlers.