Skip to content

Commit 7392cd6

Browse files
authored
Fix nonsensical deprecation for specifying listener priority (#1491)
* Fix nonsensical deprecation for specifying listener priority * Fix checkstyle error
1 parent 71feb11 commit 7392cd6

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

api/src/main/java/com/velocitypowered/api/event/PostOrder.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
*/
1313
public enum PostOrder {
1414

15-
FIRST, EARLY, NORMAL, LATE, LAST, CUSTOM
15+
FIRST, EARLY, NORMAL, LATE, LAST,
16+
17+
/**
18+
* Previously used to specify that {@link Subscribe#priority()} should be used.
19+
*
20+
* @deprecated No longer required, you only need to specify {@link Subscribe#priority()}.
21+
*/
22+
@Deprecated
23+
CUSTOM
1624

1725
}

api/src/main/java/com/velocitypowered/api/event/Subscribe.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@
3232
* The priority of this event handler. Priorities are used to determine the order in which event
3333
* handlers are called. The higher the priority, the earlier the event handler will be called.
3434
*
35-
* <p>Note that due to compatibility constraints, you must specify {@link PostOrder#CUSTOM}
36-
* in order to use this field.</p>
37-
*
3835
* @return the priority
3936
*/
40-
short priority() default Short.MIN_VALUE;
37+
short priority() default 0;
4138

4239
/**
4340
* Whether the handler must be called asynchronously. By default, all event handlers are called

proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ private void collectMethods(final Class<?> targetClass,
350350
asyncType = AsyncType.ALWAYS;
351351
}
352352

353+
// The default value of 0 will fall back to PostOrder, the default PostOrder (NORMAL) is also 0
353354
final short order;
354-
if (subscribe.order() == PostOrder.CUSTOM) {
355+
if (subscribe.priority() != 0) {
355356
order = subscribe.priority();
356357
} else {
357358
order = (short) POST_ORDER_MAP.get(subscribe.order());

0 commit comments

Comments
 (0)