You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/velocity/dev/api/event.mdx
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,20 +33,21 @@ and _not_ in `com.google.common.eventbus`.
33
33
34
34
## Orders
35
35
36
-
Every listener has a <Javadocname={"com.velocitypowered.api.event.PostOrder"}project={"velocity"}>`PostOrder`</Javadoc>.
37
-
When an event is fired, the order in which listeners are invoked is defined by their `PostOrder`.
38
-
Listeners using `PostOrder.FIRST` are called first, then `EARLY`, `NORMAL`, etc.
36
+
Every listener has a <Javadocname={"com.velocitypowered.api.event.Subscribe"}project={"velocity"}>`priority`</Javadoc>.
37
+
When an event is fired, the order in which listeners are invoked is defined by their `priority`.
38
+
The higher the priority, the earlier the event handler will be called.
39
39
40
40
State the desired order in the `@Subscribe` annotation:
41
41
42
42
```java
43
-
@Subscribe(order=PostOrder.NORMAL)
43
+
@Subscribe(priority=0, order=PostOrder.CUSTOM)
44
44
publicvoid onPlayerChat(PlayerChatEvent event) {
45
45
// do stuff
46
46
}
47
47
```
48
48
49
-
`NORMAL` is the default value if you do not specify an order.
49
+
`-32768` is the default value if you do not specify an order.
50
+
Note that due to compatibility constraints, you must specify <Javadocname={"com.velocitypowered.api.event.PostOrder"}project={"velocity"}>`PostOrder.CUSTOM`</Javadoc> in order to use this field.
50
51
51
52
## Registering listeners
52
53
@@ -121,12 +122,12 @@ return an <Javadoc name={"com.velocitypowered.api.event.EventTask"} project={"ve
121
122
or add a second return an <Javadocname={"com.velocitypowered.api.event.Continuation"}project={"velocity"}>`Continuation`</Javadoc> parameter:
0 commit comments