From ee2d1a67faf64832181df4ed1bd320d5371d7986 Mon Sep 17 00:00:00 2001 From: Aizistral Date: Fri, 1 Jul 2022 08:33:16 +0200 Subject: Remove chat safety notices Fixes #31 --- .../nochatreports/mixins/MixinChatListener.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/com/aizistral/nochatreports/mixins/MixinChatListener.java (limited to 'src/main/java') diff --git a/src/main/java/com/aizistral/nochatreports/mixins/MixinChatListener.java b/src/main/java/com/aizistral/nochatreports/mixins/MixinChatListener.java new file mode 100644 index 0000000..768c873 --- /dev/null +++ b/src/main/java/com/aizistral/nochatreports/mixins/MixinChatListener.java @@ -0,0 +1,32 @@ +package com.aizistral.nochatreports.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import com.aizistral.nochatreports.handlers.NoReportsConfig; + +import net.minecraft.client.multiplayer.PlayerInfo; +import net.minecraft.client.multiplayer.chat.ChatListener; +import net.minecraft.client.multiplayer.chat.ChatTrustLevel; +import net.minecraft.network.chat.ChatSender; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.PlayerChatMessage; + +@Mixin(ChatListener.class) +public class MixinChatListener { + + /** + * @reason No annoying safety notices, thanks. Your system is unsafe anyways. + * @author Aizistral + */ + + @Inject(method = "evaluateTrustLevel", at = @At("HEAD"), cancellable = true) + private void onEvaluateTrustLevel(ChatSender chatSender, PlayerChatMessage playerChatMessage, + Component component, PlayerInfo playerInfo, CallbackInfoReturnable info) { + info.setReturnValue(ChatTrustLevel.SECURE); + } + +} -- cgit v1.2.3