diff options
| author | Aizistral | 2022-06-23 20:59:00 +0200 |
|---|---|---|
| committer | Aizistral | 2022-06-23 20:59:07 +0200 |
| commit | 3e052b0865ddf7b988d05e6589d185693ec2025b (patch) | |
| tree | e89d636960c75d80578382e0108f3d96d2cd62b5 /src | |
| parent | 20f00aef088045dab1c534633d7a17e39b68f078 (diff) | |
Improve `MixinServerPlayer`
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/com/aizistral/nochatreports/mixins/MixinServerPlayer.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/aizistral/nochatreports/mixins/MixinServerPlayer.java b/src/main/java/com/aizistral/nochatreports/mixins/MixinServerPlayer.java index 03b885b..c2c2be5 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/MixinServerPlayer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/MixinServerPlayer.java @@ -20,7 +20,15 @@ import org.spongepowered.asm.mixin.injection.Redirect; public abstract class MixinServerPlayer { @Shadow - protected abstract int resolveChatTypeId(ResourceKey<ChatType> resourceKey); + private int resolveChatTypeId(ResourceKey<ChatType> resourceKey) { + throw new IllegalStateException("@Shadow transformation failed. Should never happen"); + } + + /** + * @reason Convert player message to system message if mod is configured respectively. + * This allows to circumvent signature check on client, as it only checks player messages. + * @author JFronny + */ @Redirect(method = "sendChatMessage(Lnet/minecraft/network/chat/PlayerChatMessage;Lnet/minecraft/network/chat/ChatSender;Lnet/minecraft/resources/ResourceKey;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;send(Lnet/minecraft/network/protocol/Packet;)V")) void extractChatMessage(ServerGamePacketListenerImpl listener, Packet<?> packet) { |
