From bf1c2c34fcb6023d448c6b129bf9458c9ee7620e Mon Sep 17 00:00:00 2001 From: Timon Seidel Date: Mon, 19 Jan 2026 16:02:53 +0100 Subject: [PATCH] chore: better explain async handling some users (2) came confused in the velocity channels because they didn't understand this example --- src/content/docs/velocity/dev/api/event.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/content/docs/velocity/dev/api/event.md b/src/content/docs/velocity/dev/api/event.md index e19092fea..375100615 100644 --- a/src/content/docs/velocity/dev/api/event.md +++ b/src/content/docs/velocity/dev/api/event.md @@ -126,7 +126,17 @@ or add a second return an [`Continuation`](jd:velocity:com.velocitypowered.api.e ```java @Subscribe(priority = 100) public void onLogin(LoginEvent event, Continuation continuation) { - doSomeAsyncProcessing().addListener(continuation::resume, continuation::resumeWithException); + doSomeAsyncProcessing().whenComplete((_, throwable) -> { + if (throwable != null) { + continuation.resumeWithException(throwable); + } else { + continuation.resume(); + } + }); + } + + private CompletableFuture doSomeAsyncProcessing() { + //... } @Subscribe(priority = 100)