From bbd013be5447171cf24179b8acdca68e57c983af Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 11 Nov 2023 15:33:19 -0800 Subject: [PATCH] Run the chat callback on the main thread as expected (#9935) --- patches/server/Adventure.patch | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index d4f07d02f1..7c826b7961 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1683,10 +1683,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent()); - callback.accept(message.withUnsignedContent(component)); + // Paper start -+ CompletableFuture componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); -+ componentFuture.thenAcceptAsync((result) -> { -+ callback.accept(message.withUnsignedContent(result.component())); -+ }, source.getServer().chatExecutor); ++ source.getChatMessageChainer().append(executor -> { ++ CompletableFuture componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); ++ return componentFuture.thenAcceptAsync((result) -> { ++ callback.accept(message.withUnsignedContent(result.component())); ++ }, executor); ++ }); + // Paper end }