diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000000..abee48eb009
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt
index 726b9f12ff4..f09a8eada37 100644
--- a/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt
+++ b/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt
@@ -85,6 +85,7 @@ object ModuleManager : Listenable, Collection by MODULE_REGISTRY {
CameraClip,
CameraView,
Chams,
+ ChatControl,
ChestAura,
ChestStealer,
CivBreak,
@@ -106,7 +107,6 @@ object ModuleManager : Listenable, Collection by MODULE_REGISTRY {
FastUse,
FlagCheck,
Fly,
- ForceUnicodeChat,
FreeCam,
Freeze,
Fucker,
diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/ForceUnicodeChat.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/ForceUnicodeChat.kt
deleted file mode 100644
index 5e5c0781beb..00000000000
--- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/ForceUnicodeChat.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * LiquidBounce Hacked Client
- * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
- * https://github.com/CCBlueX/LiquidBounce/
- */
-package net.ccbluex.liquidbounce.features.module.modules.exploit
-
-import net.ccbluex.liquidbounce.event.PacketEvent
-import net.ccbluex.liquidbounce.event.handler
-import net.ccbluex.liquidbounce.features.module.Category
-import net.ccbluex.liquidbounce.features.module.Module
-import net.minecraft.network.play.client.C01PacketChatMessage
-
-object ForceUnicodeChat :
- Module("ForceUnicodeChat", Category.EXPLOIT, subjective = true, gameDetecting = false) {
-
- val onPacket = handler { event ->
- if (event.packet is C01PacketChatMessage) {
- val chatMessage = event.packet
- val message = chatMessage.message
-
- if (message.startsWith('/')) return@handler
-
- val stringBuilder = StringBuilder()
-
- for (c in message.toCharArray())
- if (c.code in 33..128)
- stringBuilder.append(Character.toChars(c.code + 65248)) else stringBuilder.append(c)
-
- chatMessage.message = stringBuilder.toString()
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/ChatControl.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/ChatControl.kt
new file mode 100644
index 00000000000..372229c0140
--- /dev/null
+++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/ChatControl.kt
@@ -0,0 +1,20 @@
+/*
+ * LiquidBounce Hacked Client
+ * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
+ * https://github.com/CCBlueX/LiquidBounce/
+ */
+package net.ccbluex.liquidbounce.features.module.modules.misc
+
+import net.ccbluex.liquidbounce.features.module.Category
+import net.ccbluex.liquidbounce.features.module.Module
+
+object ChatControl : Module("ChatControl", Category.MISC, gameDetecting = false) {
+
+ val noChatClear by boolean("NoChatClear", true)
+ // TODO: Add StackMessage Counter (Done)
+ // TODO: Combined duplicated messages (On-Progress)
+ val stackMessage by boolean("StackMessage", true)
+ val noLengthLimit by boolean("NoLengthLimit", true)
+ val forceUnicodeChat by boolean("ForceUnicodeChat", false)
+
+}
diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiNewChat.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiNewChat.java
index ce44cd61350..142166ba921 100644
--- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiNewChat.java
+++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/gui/MixinGuiNewChat.java
@@ -5,17 +5,32 @@
*/
package net.ccbluex.liquidbounce.injection.forge.mixins.gui;
+import net.ccbluex.liquidbounce.features.module.modules.misc.ChatControl;
import net.ccbluex.liquidbounce.features.module.modules.render.HUD;
import net.ccbluex.liquidbounce.ui.font.Fonts;
+import net.minecraft.client.gui.ChatLine;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiNewChat;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IChatComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static net.ccbluex.liquidbounce.utils.client.MinecraftInstance.mc;
@Mixin(GuiNewChat.class)
public abstract class MixinGuiNewChat {
+ private final Map messageCounts = new HashMap<>();
+
@Redirect(method = {"getChatComponent", "drawChat"}, at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/FontRenderer;FONT_HEIGHT:I"))
private int injectFontChat(FontRenderer instance) {
return HUD.INSTANCE.shouldModifyChatFont() ? Fonts.font40.getHeight() : instance.FONT_HEIGHT;
@@ -30,4 +45,48 @@ private int injectFontChatB(FontRenderer instance, String text, float x, float y
private int injectFontChatC(FontRenderer instance, String text) {
return HUD.INSTANCE.shouldModifyChatFont() ? Fonts.font40.getStringWidth(text) : instance.getStringWidth(text);
}
+
+ @Inject(method = "printChatMessage", at = @At("HEAD"), cancellable = true)
+ public void onPrintChatMessage(IChatComponent chatComponent, CallbackInfo ci) {
+ String rawMessage = chatComponent.getFormattedText(); //.getUnformattedText().trim();
+ String messageId = String.valueOf(rawMessage.hashCode());
+
+ if (ChatControl.INSTANCE.handleEvents() && ChatControl.INSTANCE.getStackMessage()) {
+ int count = messageCounts.getOrDefault(messageId, 0) + 1;
+ messageCounts.put(messageId, count);
+
+ if (count > 1) {
+ String modifiedMessage = rawMessage + " " + EnumChatFormatting.GRAY + "[" + count + "x]";
+ ChatComponentText stackedComponent = new ChatComponentText(modifiedMessage);
+
+ ci.cancel();
+ mc.ingameGUI.getChatGUI().printChatMessage(stackedComponent);
+ }
+
+ if (messageCounts.size() > 100) {
+ String firstKey = messageCounts.keySet().iterator().next();
+ messageCounts.remove(firstKey);
+ }
+ }
+ }
+
+ @Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 0))
+ private int hookNoLengthLimit(List list) {
+ final ChatControl chatControl = ChatControl.INSTANCE;
+
+ if (chatControl.handleEvents() && chatControl.getNoLengthLimit()) {
+ return -1;
+ }
+
+ return list.size();
+ }
+
+ @Inject(method = "clearChatMessages", at = @At("HEAD"), cancellable = true)
+ private void hookChatClear(CallbackInfo ci) {
+ final ChatControl chatControl = ChatControl.INSTANCE;
+
+ if (chatControl.handleEvents() && chatControl.getNoChatClear()) {
+ ci.cancel();
+ }
+ }
}
diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/packets/MixinC01PacketChatMessage.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/packets/MixinC01PacketChatMessage.java
new file mode 100644
index 00000000000..9c7b740e35f
--- /dev/null
+++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/packets/MixinC01PacketChatMessage.java
@@ -0,0 +1,44 @@
+/*
+ * LiquidBounce Hacked Client
+ * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
+ * https://github.com/CCBlueX/LiquidBounce/
+ */
+package net.ccbluex.liquidbounce.injection.forge.mixins.packets;
+
+import net.ccbluex.liquidbounce.features.module.modules.misc.ChatControl;
+import net.minecraft.network.play.client.C01PacketChatMessage;
+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;
+
+@Mixin(C01PacketChatMessage.class)
+public class MixinC01PacketChatMessage {
+
+ @Shadow
+ public String message;
+
+ @Inject(method = "(Ljava/lang/String;)V", at = @At("RETURN"), cancellable = true)
+ public void injectForceUnicodeChat(String p_i45240_1_, CallbackInfo ci) {
+ if (ChatControl.INSTANCE.handleEvents() && ChatControl.INSTANCE.getForceUnicodeChat()) {
+ if (p_i45240_1_.startsWith("/")) {
+ return;
+ }
+
+ StringBuilder stringBuilder = new StringBuilder();
+
+ for (char c : p_i45240_1_.toCharArray()) {
+ if (c >= 33 && c <= 128) {
+ stringBuilder.append(Character.toChars(c + 65248));
+ } else {
+ stringBuilder.append(c);
+ }
+ }
+
+ this.message = stringBuilder.toString();
+ }
+
+ ci.cancel();
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/bg_BG.json b/src/main/resources/assets/minecraft/liquidbounce/lang/bg_BG.json
index 9936648a492..0fc37576984 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/bg_BG.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/bg_BG.json
@@ -165,8 +165,6 @@
"module.fly.description": "Позволява ви да летите в режим на оцеляване.",
- "module.forceUnicodeChat.description": "Позволява ви да изпращате съобщения на Unicode в чата.",
-
"module.freeCam.description": "Позволява ви да се преместите от тялото си.",
"module.freeLook.description": "UNTRANSLATED: Allows you to see around in third person view.",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json b/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json
index d852c1f8c2a..09001ee00d4 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json
@@ -163,6 +163,8 @@
"module.cameraView.description": "Allows you to modify your camera-Y position.",
"module.chams.description": "Allows you to see targets through blocks.",
+
+ "module.chatControl.description": "Allows you to control chat messages.",
"module.chestAura.description": "Automatically opens chests around you.",
@@ -200,8 +202,6 @@
"module.fly.description": "Allows you to fly in survival mode.",
- "module.forceUnicodeChat.description": "Allows you to send unicode messages in chat.",
-
"module.freeCam.description": "Allows you to move out of your body.",
"module.freeLook.description": "Allows you to see around in third person view.",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/pt_BR.json b/src/main/resources/assets/minecraft/liquidbounce/lang/pt_BR.json
index 1ccd3013e68..d87a78e156f 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/pt_BR.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/pt_BR.json
@@ -163,8 +163,6 @@
"module.fly.description": "Permite que você voe no modo de sobrevivência.",
- "module.forceUnicodeChat.description": "Permite que você envie mensagens unicode no chat.",
-
"module.freeCam.description": "Permite que você saia do seu corpo.",
"module.freeLook.description": "UNTRANSLATED: Allows you to see around in third person view.",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/pt_PT.json b/src/main/resources/assets/minecraft/liquidbounce/lang/pt_PT.json
index 7561abcf794..fc48cfabd86 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/pt_PT.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/pt_PT.json
@@ -162,8 +162,6 @@
"module.fly.description": "UNTRANSLATED: Allows you to fly in survival mode.",
- "module.forceUnicodeChat.description": "UNTRANSLATED: Allows you to send unicode messages in chat.",
-
"module.freeCam.description": "Permite que tu mexas enquanto fora do teu corpo.",
"module.freeLook.description": "UNTRANSLATED: Allows you to see around in third person view.",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/ru_RU.json b/src/main/resources/assets/minecraft/liquidbounce/lang/ru_RU.json
index 5fbe36cac5d..5c36c28a899 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/ru_RU.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/ru_RU.json
@@ -165,8 +165,6 @@
"module.fly.description": "Позволяет летать.",
- "module.forceUnicodeChat.description": "Позволяет отправлять в чат сообщения в юникоде.",
-
"module.freeCam.description": "Свободная летающая камера.",
"module.freeLook.description": "UNTRANSLATED: Allows you to see around in third person view.",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/zh_CN.json b/src/main/resources/assets/minecraft/liquidbounce/lang/zh_CN.json
index 344cee4f708..f2358cbcd0a 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/zh_CN.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/zh_CN.json
@@ -198,8 +198,6 @@
"module.flagCheck.description": "检测您是否被反作弊标记。",
"module.fly.description": "允许你在生存模式下飞行。",
-
- "module.forceUnicodeChat.description": "允许你在聊天栏中发送unicode消息。",
"module.freeCam.description": "允许你离开身体。(灵魂出窍)",
diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/zh_TW.json b/src/main/resources/assets/minecraft/liquidbounce/lang/zh_TW.json
index 759d359d3c2..25f9d304be1 100644
--- a/src/main/resources/assets/minecraft/liquidbounce/lang/zh_TW.json
+++ b/src/main/resources/assets/minecraft/liquidbounce/lang/zh_TW.json
@@ -170,8 +170,6 @@
"module.flagCheck.description": "偵測您是否被反作弊標記。",
"module.fly.description": "允許你在生存模式下飛行。",
-
- "module.forceUnicodeChat.description": "允許你在聊天欄中發送unicode訊息。",
"module.freeCam.description": "允許你離開身體。(靈魂出竅)",
diff --git a/src/main/resources/liquidbounce.forge.mixins.json b/src/main/resources/liquidbounce.forge.mixins.json
index f62737dec07..ce629c778cf 100644
--- a/src/main/resources/liquidbounce.forge.mixins.json
+++ b/src/main/resources/liquidbounce.forge.mixins.json
@@ -77,6 +77,7 @@
"gui.MixinGuiAchievement",
"gui.MixinGuiContainer",
"gui.MixinGuiTextField",
+ "packets.MixinC01PacketChatMessage",
"render.MixinItemRenderer",
"render.MixinRenderGlobal",
"tweaks.MixinEntityFX"