mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
Run the chat callback on the main thread as expected (#9935)
This commit is contained in:
@@ -1683,10 +1683,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent());
|
- Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent());
|
||||||
- callback.accept(message.withUnsignedContent(component));
|
- callback.accept(message.withUnsignedContent(component));
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
|
+ source.getChatMessageChainer().append(executor -> {
|
||||||
+ componentFuture.thenAcceptAsync((result) -> {
|
+ CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
|
||||||
+ callback.accept(message.withUnsignedContent(result.component()));
|
+ return componentFuture.thenAcceptAsync((result) -> {
|
||||||
+ }, source.getServer().chatExecutor);
|
+ callback.accept(message.withUnsignedContent(result.component()));
|
||||||
|
+ }, executor);
|
||||||
|
+ });
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user