Skip to content

Commit 8b3c18c

Browse files
authored
feat: update Velocity docs for event priorities (#646)
1 parent 68138bc commit 8b3c18c

File tree

1 file changed

+11
-11
lines changed
  • src/content/docs/velocity/dev/api

1 file changed

+11
-11
lines changed

src/content/docs/velocity/dev/api/event.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ The higher the priority, the earlier the event handler will be called.
3838
State the desired order in the `@Subscribe` annotation:
3939

4040
```java
41-
@Subscribe(priority = 0, order = PostOrder.CUSTOM)
41+
@Subscribe(priority = 10)
42+
public void onPlayerChatFirst(PlayerChatEvent event) {
43+
// this method fires first
44+
}
45+
46+
@Subscribe(priority = 5)
4247
public void onPlayerChat(PlayerChatEvent event) {
43-
// do stuff
48+
// this method fires after the one above
4449
}
4550
```
4651

47-
`-32768` is the default value if you do not specify an order.
48-
:::note
49-
50-
Due to compatibility constraints, you must specify [`PostOrder.CUSTOM`](jd:velocity:com.velocitypowered.api.event.PostOrder#CUSTOM) in order to use this field.
51-
52-
:::
52+
`0` is the default value if you do not specify an order.
5353

5454
## Registering listeners
5555

@@ -92,7 +92,7 @@ public class VelocityTest {
9292

9393
public class MyListener {
9494

95-
@Subscribe(order = PostOrder.EARLY)
95+
@Subscribe
9696
public void onPlayerChat(PlayerChatEvent event) {
9797
// do something here
9898
}
@@ -124,12 +124,12 @@ return an [`EventTask`](jd:velocity:com.velocitypowered.api.event.EventTask)
124124
or add a second return an [`Continuation`](jd:velocity:com.velocitypowered.api.event.Continuation) parameter:
125125

126126
```java
127-
@Subscribe(priority = 100, order = PostOrder.CUSTOM)
127+
@Subscribe(priority = 100)
128128
public void onLogin(LoginEvent event, Continuation continuation) {
129129
doSomeAsyncProcessing().addListener(continuation::resume, continuation::resumeWithException);
130130
}
131131

132-
@Subscribe(priority = 100, order = PostOrder.CUSTOM)
132+
@Subscribe(priority = 100)
133133
public EventTask onPlayerChat(PlayerChatEvent event) {
134134
if (mustFurtherProcess(event)) {
135135
return EventTask.async(() => ...);

0 commit comments

Comments
 (0)