Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ImToggle committed Jul 29, 2024
2 parents ddd9e46 + db9170e commit 0de9a27
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
17 changes: 16 additions & 1 deletion src/main/kotlin/org/polyfrost/chatting/config/ChattingConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -388,6 +402,7 @@ object ChattingConfig : Config(
}
} catch (_: ClassNotFoundException) {}

addDependency("rightClickCopyCtrl", "rightClickCopy")
addDependency("fadeTime", "fade")
addDependency("offsetNonPlayerMessages", "showChatHeads")
addDependency("hideChatHeadOnConsecutiveMessages", "showChatHeads")
Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/mixins.chatting.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"verbose": true,
"client": [
"ChatLineMixin",
"ChatStyleMixin",
"ClientCommandHandlerMixin",
"EntityPlayerSPMixin",
"EntityRendererMixin",
Expand All @@ -27,11 +28,9 @@
"GuiTextFieldMixin",
"GuiUtilsMixin",
"HUDUtilsMixin",
"InventoryPlayerMixin"
],
"mixins": [
"ChatPeekMixin_SkyHanni",
"ChatStyleMixin",
"EssentialKeybindingRegistryMixin"
"InventoryPlayerMixin",
"compat.ChatPeekMixin_SkyHanni",
"compat.ChatTabsMixin_SkytilsCopyChat",
"compat.EssentialKeybindingRegistryMixin"
]
}

0 comments on commit 0de9a27

Please sign in to comment.