flexible listener priorities#1504
Conversation
|
Why not reuse the PacketListenerPriority? |
This is a breaking change; the class type, and structure would have changed. This enum has remained the same since 1.0 (5 years). Unless breaking plugins... Isn't a concern? Then sure, It would make more sense to reuse it. |
|
@ieatglu3 can you activate this? want to push a few changes + formatting fixes |
there |
|
Thanks |
| // no point in providing a backwards compat if method returns the modern type | ||
| // + the new type has to be exposed in one way or another (the event manager needs it), cant get around this one :( | ||
| return this.priority; |
There was a problem hiding this comment.
| // no point in providing a backwards compat if method returns the modern type | |
| // + the new type has to be exposed in one way or another (the event manager needs it), cant get around this one :( | |
| return this.priority; | |
| // backwards compat, developers may have overrides | |
| return ListenerPriority.fromLegacy(this.getPriority()); |
this needs to check for overrides of #getPriority()
There was a problem hiding this comment.
bro?? This always just returns a predefined value; custom priorities become useless. Even then, this Is an overcompensation, If someone overrode #getPriority, then this just means their legacy override would be ignored in favour for what was passed into the constructor. The priority has always been final meaning if someone overrode it's !!! getter !!! #getPriority, the override inherently becomes unsafe.

This rewrites the listener priority system in a way that is more robust, including supporting custom integer priorities.
For maximum backwards compatibility, this does not remove the legacy
PacketListenerPriority, nor its usages, instead just deprecates it without sacrificing existing functionality.The modern listener priority class is now
ListenerPriority, with the same default/predefined priority values as its legacy counterpart.User's can continue to use existing priorities, or create their own using the new system.