From 7ea5b9ab24c78f01bdbbd4357fc87b75bbe4d950 Mon Sep 17 00:00:00 2001
From: Wyvest <45589059+Wyvest@users.noreply.github.com>
Date: Sun, 11 Dec 2022 17:06:21 -0500
Subject: new: chat heads

---
 .../cc/woverflow/chatting/config/ChattingConfig.kt | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'src/main/kotlin/cc/woverflow/chatting')

diff --git a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt
index 40ebd9a..a7f6ffe 100644
--- a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt
+++ b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt
@@ -13,6 +13,7 @@ import cc.woverflow.chatting.chat.ChatShortcuts
 import cc.woverflow.chatting.chat.ChatTab
 import cc.woverflow.chatting.chat.ChatTabs
 import cc.woverflow.chatting.gui.components.TabButton
+import cc.woverflow.chatting.hook.ChatLineHook
 import java.io.File
 
 object ChattingConfig :
@@ -66,6 +67,27 @@ object ChattingConfig :
     )
     var informForAlternatives = true
 
+    @Switch(
+        name = "Show Chat Heads",
+        description = "Show the chat heads of players in chat",
+        category = "Chat Heads"
+    )
+    var showChatHeads = true
+
+    @Switch(
+        name = "Offset Non-Player Messages",
+        description = "Offset all messages, even if a player has not been detected.",
+        category = "Chat Heads"
+    )
+    var offsetNonPlayerMessages = false
+
+    @Switch(
+        name = "Hide Chat Head on Consecutive Messages",
+        description = "Hide the chat head if the previous message was from the same player.",
+        category = "Chat Heads"
+    )
+    var hideChatHeadOnConsecutiveMessages = true
+
     /*/
     @Property(
         type = PropertyType.SWITCH,
@@ -191,6 +213,11 @@ object ChattingConfig :
 
     init {
         initialize()
+        addDependency("offsetNonPlayerMessages", "showChatHeads")
+        addDependency("hideChatHeadOnConsecutiveMessages", "showChatHeads")
+        addListener("hideChatHeadOnConsecutiveMessages") {
+            ChatLineHook.chatLines.map { it.get() as ChatLineHook? }.forEach { it?.updatePlayerInfo() }
+        }
         addListener("chatTabs") {
             ChatTabs.initialize()
             if (!chatTabs) {
-- 
cgit