[BUG] Fix chat events not working on 1.20/1.20.1 (Fabric)

This commit is contained in:
2024-08-21 23:08:34 +02:00
parent 0c321d9194
commit 0b2a59af1a
2 changed files with 4 additions and 4 deletions

View File

@@ -28,8 +28,8 @@ public class ServerGamePacketListenerImplMixin {
at = @At("HEAD"), at = @At("HEAD"),
cancellable = true cancellable = true
) )
private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, Void void_, CallbackInfo ci) { private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<Component> completableFuture, CompletableFuture<FilteredText> completableFuture2, Void void_, CallbackInfo ci) {
Component arg2 = completableFuture2.join(); Component arg2 = completableFuture.join();
Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event); CraterEventBus.INSTANCE.postEvent(event);

View File

@@ -21,8 +21,8 @@
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) { - private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
- Component finalcomp = arg2 == null ? arg.decoratedContent() : arg2; - Component finalcomp = arg2 == null ? arg.decoratedContent() : arg2;
- CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalcomp.getString(), ChatUtils.mojangToAdventure(finalcomp)); - CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalcomp.getString(), ChatUtils.mojangToAdventure(finalcomp));
+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<FilteredText> completableFuture, CompletableFuture<Component> completableFuture2, Void void_, CallbackInfo ci) { + private void injectChatEvent(PlayerChatMessage arg, CompletableFuture<Component> completableFuture, CompletableFuture<FilteredText> completableFuture2, Void void_, CallbackInfo ci) {
+ Component arg2 = completableFuture2.join(); + Component arg2 = completableFuture.join();
+ Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; + Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
+ CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); + CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event); CraterEventBus.INSTANCE.postEvent(event);