diff --git a/gradle.properties b/gradle.properties index bc34423..b518043 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_name = Chatting mod_id = chatting -mod_version = 2.0.5 +mod_version = 2.0.6 mod_archives_name = Chatting # Gradle Configuration -- DO NOT TOUCH THESE VALUES. diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java index 97a07b3..17bcf27 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiChatMixin.java @@ -140,7 +140,7 @@ private void mouseClicked(int mouseX, int mouseY, int mouseButton, CallbackInfo if (hook.chatting$isHovering()) { boolean copy = ChattingConfig.INSTANCE.getChatCopy(); int right = (int) ((hook.chatting$getRight() + ModCompatHooks.getXOffset() + 1 + hud.getPaddingX() * (ChattingConfig.INSTANCE.getExtendBG() ? 1f : 2f)) * hud.getScale() + (int) hud.position.getX()) * scale; - if (copy && x > right && x < right + 9 * hud.getScale() * scale || (mouseButton == 1 && ChattingConfig.INSTANCE.getRightClickCopy())) { + if (copy && x > right && x < right + 9 * hud.getScale() * scale || (mouseButton == 1 && ChattingConfig.INSTANCE.getRightClickCopy() && (!ChattingConfig.INSTANCE.getRightClickCopyCtrl() || UKeyboard.isCtrlKeyDown()))) { Transferable message = hook.chatting$getChattingChatComponent(Mouse.getY()); if (message == null) return; try { diff --git a/src/main/java/org/polyfrost/chatting/mixin/ChatPeekMixin_SkyHanni.java b/src/main/java/org/polyfrost/chatting/mixin/compat/ChatPeekMixin_SkyHanni.java similarity index 96% rename from src/main/java/org/polyfrost/chatting/mixin/ChatPeekMixin_SkyHanni.java rename to src/main/java/org/polyfrost/chatting/mixin/compat/ChatPeekMixin_SkyHanni.java index c065b94..b5792c8 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/ChatPeekMixin_SkyHanni.java +++ b/src/main/java/org/polyfrost/chatting/mixin/compat/ChatPeekMixin_SkyHanni.java @@ -1,4 +1,4 @@ -package org.polyfrost.chatting.mixin; +package org.polyfrost.chatting.mixin.compat; import cc.polyfrost.oneconfig.utils.Notifications; import org.polyfrost.chatting.config.ChattingConfig; diff --git a/src/main/java/org/polyfrost/chatting/mixin/compat/ChatTabsMixin_SkytilsCopyChat.java b/src/main/java/org/polyfrost/chatting/mixin/compat/ChatTabsMixin_SkytilsCopyChat.java new file mode 100644 index 0000000..369678a --- /dev/null +++ b/src/main/java/org/polyfrost/chatting/mixin/compat/ChatTabsMixin_SkytilsCopyChat.java @@ -0,0 +1,45 @@ +package org.polyfrost.chatting.mixin.compat; + +import cc.polyfrost.oneconfig.utils.Notifications; +import net.minecraft.client.gui.GuiScreen; +import org.polyfrost.chatting.config.ChattingConfig; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Pseudo +@Mixin(targets = "gg.skytils.skytilsmod.features.impl.handlers.ChatTabs") +public class ChatTabsMixin_SkytilsCopyChat { + + @Unique + private static long chatting$lastNotify = System.currentTimeMillis(); + + @Dynamic("Skytils") + @Redirect(method = "onAttemptCopy", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;isCtrlKeyDown()Z")) + private boolean onAttemptCopy() { + boolean isCtrlKeyDown = GuiScreen.isCtrlKeyDown(); + if (!ChattingConfig.INSTANCE.getRightClickCopy() && isCtrlKeyDown) { + if (System.currentTimeMillis() - chatting$lastNotify >= 1000) { + Notifications.INSTANCE.send("Chatting", "Skytils' Copy Chat has been replaced by Chatting. You can configure this via OneConfig, by clicking the right shift key on your keyboard, or by typing /chatting in your chat."); + chatting$lastNotify = System.currentTimeMillis(); + } + } + return false; + } + + @Dynamic("Skytils") + @Redirect(method = "onAttemptCopy", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;isShiftKeyDown()Z")) + private boolean onAttemptCopyShift() { + boolean isShiftKeyDown = GuiScreen.isShiftKeyDown(); + if (!ChattingConfig.INSTANCE.getRightClickCopy() && isShiftKeyDown) { + if (System.currentTimeMillis() - chatting$lastNotify >= 1000) { + Notifications.INSTANCE.send("Chatting", "Skytils' Copy Chat has been replaced by Chatting. You can configure this via OneConfig, by clicking the right shift key on your keyboard, or by typing /chatting in your chat."); + chatting$lastNotify = System.currentTimeMillis(); + } + } + return false; + } +} diff --git a/src/main/java/org/polyfrost/chatting/mixin/EssentialKeybindingRegistryMixin.java b/src/main/java/org/polyfrost/chatting/mixin/compat/EssentialKeybindingRegistryMixin.java similarity index 96% rename from src/main/java/org/polyfrost/chatting/mixin/EssentialKeybindingRegistryMixin.java rename to src/main/java/org/polyfrost/chatting/mixin/compat/EssentialKeybindingRegistryMixin.java index 45c3ba9..4c25699 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/EssentialKeybindingRegistryMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/compat/EssentialKeybindingRegistryMixin.java @@ -1,4 +1,4 @@ -package org.polyfrost.chatting.mixin; +package org.polyfrost.chatting.mixin.compat; import cc.polyfrost.oneconfig.utils.Notifications; import org.polyfrost.chatting.config.ChattingConfig; diff --git a/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt b/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt index 0c69a2a..65b6be8 100644 --- a/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt +++ b/src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt @@ -190,6 +190,12 @@ object ChattingConfig : Config( ) var rightClickCopy = false + @Switch( + name = "Only Click Copy Chat Message when Holding CTRL", category = "Buttons", + description = "Only allow right clicking on a chat message to copy it when holding CTRL." + ) + var rightClickCopyCtrl = true + @Switch( name = "Delete Chat Message Button", category = "Buttons", description = "Enable deleting individual chat messages via a button." @@ -253,13 +259,21 @@ object ChattingConfig : Config( */ @Info( - text = "If Chatting detects a public chat message that seems like spam, and the probability is higher than this, it will hide it.\n" + "Made for Hypixel Skyblock. Set to 100% to disable. 95% is a reasonable threshold to use it at.\n" + "Note that this is not and never will be 100% accurate; however, it's pretty much guaranteed to block most spam.", + text = "If Chatting detects a public chat message that seems like spam, and the probability is higher than this, it will hide it.", size = 2, category = "Player Chats", type = InfoType.INFO ) var ignored = false + @Info( + text = "Made for Hypixel Skyblock. Set to 100% to disable. 95% is a reasonable threshold to use it at. May not be accurate.", + size = 2, + category = "Player Chats", + type = InfoType.INFO + ) + var ignored1 = false + @Slider( min = 80F, max = 100F, name = "Spam Blocker Threshold", category = "Player Chats" ) @@ -388,6 +402,7 @@ object ChattingConfig : Config( } } catch (_: ClassNotFoundException) {} + addDependency("rightClickCopyCtrl", "rightClickCopy") addDependency("fadeTime", "fade") addDependency("offsetNonPlayerMessages", "showChatHeads") addDependency("hideChatHeadOnConsecutiveMessages", "showChatHeads") diff --git a/src/main/resources/mixins.chatting.json b/src/main/resources/mixins.chatting.json index f7e4385..2bdc703 100644 --- a/src/main/resources/mixins.chatting.json +++ b/src/main/resources/mixins.chatting.json @@ -6,6 +6,7 @@ "verbose": true, "client": [ "ChatLineMixin", + "ChatStyleMixin", "ClientCommandHandlerMixin", "EntityPlayerSPMixin", "EntityRendererMixin", @@ -27,11 +28,9 @@ "GuiTextFieldMixin", "GuiUtilsMixin", "HUDUtilsMixin", - "InventoryPlayerMixin" - ], - "mixins": [ - "ChatPeekMixin_SkyHanni", - "ChatStyleMixin", - "EssentialKeybindingRegistryMixin" + "InventoryPlayerMixin", + "compat.ChatPeekMixin_SkyHanni", + "compat.ChatTabsMixin_SkytilsCopyChat", + "compat.EssentialKeybindingRegistryMixin" ] }