Fix nonsensical deprecation for specifying listener priority (#1491)
* Fix nonsensical deprecation for specifying listener priority * Fix checkstyle error
This commit is contained in:
@@ -12,6 +12,14 @@ package com.velocitypowered.api.event;
|
||||
*/
|
||||
public enum PostOrder {
|
||||
|
||||
FIRST, EARLY, NORMAL, LATE, LAST, CUSTOM
|
||||
FIRST, EARLY, NORMAL, LATE, LAST,
|
||||
|
||||
/**
|
||||
* Previously used to specify that {@link Subscribe#priority()} should be used.
|
||||
*
|
||||
* @deprecated No longer required, you only need to specify {@link Subscribe#priority()}.
|
||||
*/
|
||||
@Deprecated
|
||||
CUSTOM
|
||||
|
||||
}
|
||||
|
@@ -32,12 +32,9 @@ public @interface Subscribe {
|
||||
* The priority of this event handler. Priorities are used to determine the order in which event
|
||||
* handlers are called. The higher the priority, the earlier the event handler will be called.
|
||||
*
|
||||
* <p>Note that due to compatibility constraints, you must specify {@link PostOrder#CUSTOM}
|
||||
* in order to use this field.</p>
|
||||
*
|
||||
* @return the priority
|
||||
*/
|
||||
short priority() default Short.MIN_VALUE;
|
||||
short priority() default 0;
|
||||
|
||||
/**
|
||||
* Whether the handler must be called asynchronously. By default, all event handlers are called
|
||||
|
@@ -350,8 +350,9 @@ public class VelocityEventManager implements EventManager {
|
||||
asyncType = AsyncType.ALWAYS;
|
||||
}
|
||||
|
||||
// The default value of 0 will fall back to PostOrder, the default PostOrder (NORMAL) is also 0
|
||||
final short order;
|
||||
if (subscribe.order() == PostOrder.CUSTOM) {
|
||||
if (subscribe.priority() != 0) {
|
||||
order = subscribe.priority();
|
||||
} else {
|
||||
order = (short) POST_ORDER_MAP.get(subscribe.order());
|
||||
|
Reference in New Issue
Block a user