diff --git a/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java b/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java index ce6a603..2fb87e1 100644 --- a/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java @@ -4,16 +4,20 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent; import com.hypherionmc.craterlib.core.event.CraterEventBus; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; import com.hypherionmc.craterlib.utils.ChatUtils; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.FilteredText; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; @Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE) public class ServerGamePacketListenerImplMixin { @@ -22,16 +26,17 @@ public class ServerGamePacketListenerImplMixin { public ServerPlayer player; @Inject( - method = "lambda$handleChat$8", + method = "lambda$handleChat$9", at = @At("HEAD"), cancellable = true ) - Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; - private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { + private void injectChatEvent(CompletableFuture completableFuture, CompletableFuture completableFuture2, PlayerChatMessage arg, Executor executor, CallbackInfoReturnable cir) { + Component comp2 = completableFuture2.join(); + Component finalArg = comp2 == null ? arg.decoratedContent() : comp2; CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) - ci.cancel(); + cir.cancel(); } } diff --git a/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java b/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java index 115dc72..d0db43b 100644 --- a/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java @@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent; import com.hypherionmc.craterlib.core.event.CraterEventBus; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; import com.hypherionmc.craterlib.utils.ChatUtils; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.FilteredText; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin { at = @At("HEAD"), cancellable = true ) - Component finalArg = component == null ? arg.decoratedContent() : component; - private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { + private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { + Component comp2 = completablefuture1.join(); + Component finalArg = comp2 == null ? arg.decoratedContent() : comp2; CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) diff --git a/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java b/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java index ce6a603..fa3f2ee 100644 --- a/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java @@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent; import com.hypherionmc.craterlib.core.event.CraterEventBus; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; import com.hypherionmc.craterlib.utils.ChatUtils; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.FilteredText; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin { at = @At("HEAD"), cancellable = true ) + private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { + Component arg2 = completableFuture2.join(); Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; - private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) diff --git a/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java b/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java index 161760a..0dea232 100644 --- a/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java @@ -4,8 +4,10 @@ import com.hypherionmc.craterlib.api.events.server.CraterServerChatEvent; import com.hypherionmc.craterlib.core.event.CraterEventBus; import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; import com.hypherionmc.craterlib.utils.ChatUtils; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.FilteredText; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -26,8 +28,9 @@ public class ServerGamePacketListenerImplMixin { at = @At("HEAD"), cancellable = true ) + private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { + Component component = completablefuture1.join(); Component finalArg = component == null ? arg.decoratedContent() : component; - private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) diff --git a/patches/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch b/patches/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch index f21c791..8dbf2df 100644 --- a/patches/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch +++ b/patches/1.19.3/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch @@ -1,37 +1,35 @@ --- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java -@@ -4,10 +4,8 @@ - import com.hypherionmc.craterlib.core.event.CraterEventBus; - import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; - import com.hypherionmc.craterlib.utils.ChatUtils; --import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.PlayerChatMessage; - import net.minecraft.server.level.ServerPlayer; --import net.minecraft.server.network.FilteredText; - import net.minecraft.server.network.ServerGamePacketListenerImpl; - import org.spongepowered.asm.mixin.Mixin; - import org.spongepowered.asm.mixin.Shadow; -@@ -15,6 +13,8 @@ +@@ -14,6 +14,10 @@ + import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -+import java.util.concurrent.CompletableFuture; ++import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + ++import java.util.concurrent.CompletableFuture; ++import java.util.concurrent.Executor; + @Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE) public class ServerGamePacketListenerImplMixin { - -@@ -22,12 +22,12 @@ +@@ -22,16 +26,17 @@ public ServerPlayer player; @Inject( - method = "lambda$handleChat$5", -+ method = "lambda$handleChat$8", ++ method = "lambda$handleChat$9", at = @At("HEAD"), cancellable = true ) - private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) { - Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; -+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { +- Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; ++ private void injectChatEvent(CompletableFuture completableFuture, CompletableFuture completableFuture2, PlayerChatMessage arg, Executor executor, CallbackInfoReturnable cir) { ++ Component comp2 = completableFuture2.join(); ++ Component finalArg = comp2 == null ? arg.decoratedContent() : comp2; CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) +- ci.cancel(); ++ cir.cancel(); + } + + } diff --git a/patches/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch b/patches/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch index c7744e3..411181d 100644 --- a/patches/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch +++ b/patches/1.19.3/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch @@ -1,17 +1,6 @@ --- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java -@@ -4,10 +4,8 @@ - import com.hypherionmc.craterlib.core.event.CraterEventBus; - import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; - import com.hypherionmc.craterlib.utils.ChatUtils; --import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.PlayerChatMessage; - import net.minecraft.server.level.ServerPlayer; --import net.minecraft.server.network.FilteredText; - import net.minecraft.server.network.ServerGamePacketListenerImpl; - import org.spongepowered.asm.mixin.Mixin; - import org.spongepowered.asm.mixin.Shadow; -@@ -15,6 +13,8 @@ +@@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -20,7 +9,7 @@ @Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE) public class ServerGamePacketListenerImplMixin { -@@ -22,12 +22,12 @@ +@@ -22,12 +24,13 @@ public ServerPlayer player; @Inject( @@ -30,8 +19,10 @@ cancellable = true ) - private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) { - Component finalArg = component == null ? arg.decoratedContent() : component; -+ private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { +- Component finalArg = component == null ? arg.decoratedContent() : component; ++ private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { ++ Component comp2 = completablefuture1.join(); ++ Component finalArg = comp2 == null ? arg.decoratedContent() : comp2; CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); if (event.wasCancelled()) diff --git a/patches/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch b/patches/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch index f21c791..3c8670d 100644 --- a/patches/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch +++ b/patches/1.20/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch @@ -1,17 +1,6 @@ --- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java -@@ -4,10 +4,8 @@ - import com.hypherionmc.craterlib.core.event.CraterEventBus; - import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; - import com.hypherionmc.craterlib.utils.ChatUtils; --import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.PlayerChatMessage; - import net.minecraft.server.level.ServerPlayer; --import net.minecraft.server.network.FilteredText; - import net.minecraft.server.network.ServerGamePacketListenerImpl; - import org.spongepowered.asm.mixin.Mixin; - import org.spongepowered.asm.mixin.Shadow; -@@ -15,6 +13,8 @@ +@@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -20,7 +9,7 @@ @Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE) public class ServerGamePacketListenerImplMixin { -@@ -22,12 +22,12 @@ +@@ -22,11 +24,12 @@ public ServerPlayer player; @Inject( @@ -30,8 +19,8 @@ cancellable = true ) - private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) { ++ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { ++ Component arg2 = completableFuture2.join(); Component finalArg = arg2 == null ? arg.decoratedContent() : arg2; -+ private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) { CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); - if (event.wasCancelled()) diff --git a/patches/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch b/patches/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch index 29b5cef..d9ab294 100644 --- a/patches/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch +++ b/patches/1.20/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java.patch @@ -1,17 +1,6 @@ --- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java +++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerGamePacketListenerImplMixin.java -@@ -4,10 +4,8 @@ - import com.hypherionmc.craterlib.core.event.CraterEventBus; - import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer; - import com.hypherionmc.craterlib.utils.ChatUtils; --import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.PlayerChatMessage; - import net.minecraft.server.level.ServerPlayer; --import net.minecraft.server.network.FilteredText; - import net.minecraft.server.network.ServerGamePacketListenerImpl; - import org.spongepowered.asm.mixin.Mixin; - import org.spongepowered.asm.mixin.Shadow; -@@ -15,6 +13,8 @@ +@@ -15,6 +15,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -20,7 +9,7 @@ @Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE) public class ServerGamePacketListenerImplMixin { -@@ -22,12 +22,12 @@ +@@ -22,11 +24,12 @@ public ServerPlayer player; @Inject( @@ -30,8 +19,8 @@ cancellable = true ) - private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) { ++ private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { ++ Component component = completablefuture1.join(); Component finalArg = component == null ? arg.decoratedContent() : component; -+ private void injectChatEvent(CompletableFuture completablefuture1, PlayerChatMessage arg, CompletableFuture completablefuture, Void p_248218_, CallbackInfo ci) { CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg)); CraterEventBus.INSTANCE.postEvent(event); - if (event.wasCancelled())