HypixelDev / ModAPI

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

Handler unloading #12

Closed inglettronald closed 4 months ago

inglettronald commented 6 months ago

Description

Allows the user to close/unload ClientBoundPacketHandler implementations.

Why?

Dynamic handler loading seems like a novel idea.

ConnorLinfoot commented 6 months ago

I don't necessarily disagree with adding an option to remove handlers, but why would we need a close method? If you have the reference to the handler instance you should be able to handle anything else as a result of removing the handler yourself.

inglettronald commented 6 months ago

The user could certainly call there own close method after removing a handler. However, it looks like all of the mods can access each-other handlers currently, and this close method followed that expectation.

ConnorLinfoot commented 6 months ago

The handlers registered aren't currently accessible, the only way to add a handler is to provide the handler itself. Other mods don't have access to the handler added.

inglettronald commented 6 months ago

Other mods should be able to access it through mixin, reflection, or access wideners. However, at that point you could probably write your own injection into unregisterHandler anyway to write a close method, so I don't really care if this close method gets kept or not.

ConnorLinfoot commented 4 months ago

I think with the current goals and implementation of the Mod API, methods to unregister handlers are unnecessary