Skip to content

Commit 45482b6

Browse files
Update event.mdx
Update event.mdx to remove deprecated API usage
1 parent 04a1f02 commit 45482b6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/velocity/dev/api/event.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,21 @@ and _not_ in `com.google.common.eventbus`.
3333

3434
## Orders
3535

36-
Every listener has a <Javadoc name={"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 <Javadoc name={"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.
3939

4040
State the desired order in the `@Subscribe` annotation:
4141

4242
```java
43-
@Subscribe(order = PostOrder.NORMAL)
43+
@Subscribe(priority = 0, order = PostOrder.CUSTOM)
4444
public void onPlayerChat(PlayerChatEvent event) {
4545
// do stuff
4646
}
4747
```
4848

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 <Javadoc name={"com.velocitypowered.api.event.PostOrder"} project={"velocity"}>`PostOrder.CUSTOM`</Javadoc> in order to use this field.
5051

5152
## Registering listeners
5253

@@ -121,12 +122,12 @@ return an <Javadoc name={"com.velocitypowered.api.event.EventTask"} project={"ve
121122
or add a second return an <Javadoc name={"com.velocitypowered.api.event.Continuation"} project={"velocity"}>`Continuation`</Javadoc> parameter:
122123

123124
```java
124-
@Subscribe(order = PostOrder.EARLY)
125+
@Subscribe(priority = 100,order = PostOrder.CUSTOM)
125126
public void onLogin(LoginEvent event, Continuation continuation) {
126127
doSomeAsyncProcessing().addListener(continuation::resume, continuation::resumeWithException);
127128
}
128129

129-
@Subscribe(order = PostOrder.EARLY)
130+
@Subscribe(priority = 100,order = PostOrder.CUSTOM)
130131
public EventTask onPlayerChat(PlayerChatEvent event) {
131132
if (mustFurtherProcess(event)) {
132133
return EventTask.async(() => ...);

0 commit comments

Comments
 (0)