diff --git a/api/src/main/java/com/velocitypowered/api/event/PostOrder.java b/api/src/main/java/com/velocitypowered/api/event/PostOrder.java index 0d52ed2c08..98fa2e86f5 100644 --- a/api/src/main/java/com/velocitypowered/api/event/PostOrder.java +++ b/api/src/main/java/com/velocitypowered/api/event/PostOrder.java @@ -12,6 +12,14 @@ */ 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 } diff --git a/api/src/main/java/com/velocitypowered/api/event/Subscribe.java b/api/src/main/java/com/velocitypowered/api/event/Subscribe.java index abb96c9499..e0cdeb86b5 100644 --- a/api/src/main/java/com/velocitypowered/api/event/Subscribe.java +++ b/api/src/main/java/com/velocitypowered/api/event/Subscribe.java @@ -32,12 +32,9 @@ * 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. * - *
Note that due to compatibility constraints, you must specify {@link PostOrder#CUSTOM} - * in order to use this field.
- * * @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 diff --git a/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java b/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java index 4c48068cb6..9d54b2d073 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java @@ -350,8 +350,9 @@ private void collectMethods(final Class> targetClass, 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());