Skip to content

Commit

Permalink
notification
Browse files Browse the repository at this point in the history
  • Loading branch information
sqlerrorthing committed Dec 18, 2024
1 parent 89cf094 commit 22bf1fe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@

import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.ChatSendEvent;
import net.ccbluex.liquidbounce.event.events.NotificationEvent;
import net.ccbluex.liquidbounce.features.module.modules.misc.betterchat.ModuleBetterChat;
import net.ccbluex.liquidbounce.interfaces.ChatHudAddition;
import net.ccbluex.liquidbounce.utils.client.ClientUtilsKt;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.hud.ChatHudLine;
import net.minecraft.client.gui.screen.ChatScreen;
Expand Down Expand Up @@ -69,7 +71,7 @@ private void handleChatMessage(String chatText, boolean addToHistory, CallbackIn

@Inject(method = "mouseClicked", at = @At("HEAD"))
private void hookMouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
if (!(ModuleBetterChat.INSTANCE.getRunning() && ModuleBetterChat.INSTANCE.getCopy())) {
if (!(ModuleBetterChat.INSTANCE.getRunning() && ModuleBetterChat.Copy.INSTANCE.getRunning())) {
return;
}

Expand Down Expand Up @@ -114,6 +116,14 @@ private void copyMessage(List<ChatHudLine.Visible> messageParts, int button) {

if (isPressed(GLFW.GLFW_KEY_LEFT_SHIFT, GLFW.GLFW_KEY_RIGHT_SHIFT) && button == GLFW.GLFW_MOUSE_BUTTON_1) {
client.keyboard.setClipboard(builder.toString());

if (ModuleBetterChat.Copy.INSTANCE.getNotification()) {
ClientUtilsKt.notification(
"ChatCopy",
"The line is copied",
NotificationEvent.Severity.SUCCESS
);
}
} else if (button == GLFW.GLFW_MOUSE_BUTTON_2) {
if (client.currentScreen instanceof ChatScreen chat) {
((MixinChatScreenAccessor) chat).getChatField().setText(builder.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ object ModuleBetterChat : ClientModule("BetterChat", Category.MISC, aliases = ar
private val forceUnicodeChat by boolean("ForceUnicodeChat", false)

init {
tree(AntiSpam)
treeAll(
AntiSpam,
Copy
)
}

val copy by boolean("Copy", true)

object Copy : ToggleableConfigurable(this, "Copy", true) {
val notification by boolean("NotificationAfterCopy", true)
}

var antiChatClearPaused = false

Expand Down

0 comments on commit 22bf1fe

Please sign in to comment.