Adding ability to add player-specific packet listeners
My motivate for this PR is simple, I'm too performance obsessed and doing ConcurrentHashMap calls to get data based is not for me, maybe others feel the same way, so the whole point of this PR is to make so you can register player-specific listeners so you can store state within the listener itself.
TODO:
- [x] Separate EventManager impl to BaseEventManager
- [x] Recreate the whole EventManager structure to allow inheriting packet listeners
- [x] Store EventManager in user object itself
- [x] Change the calls to be made for the User EventManager not global.
Would Java cry that the class has been changed from class to Interface? since none of the methods been removed.
So in theory the signature did not change of it apart that it became an interface
Would Java cry that the class has been changed from class to Interface? since none of the methods been removed.
Yes, it will
Okay imma make it abstract class
Gotta change the naming a bit of the event managers butt I think the structure-rework is done and should be backwards compatible.
@booky10 Pretty much done, apart from cleaning up some parts, lmk what your thoughts on the changes
P.S: Tested with Grim for backwards-compatability
You could also use a ThreadLocal to store state bound to netty threads, example: https://github.com/Beaness/UnnamedAC/blob/6042a33fa1fb53ca6b49188a53f4c399a8202975/plugin/src/main/java/me/beanes/acid/plugin/player/PlayerManager.java#L10