diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-29 16:36:54 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-03-29 16:36:54 +0100 |
commit | 18ffc756d1ed6da48e2bfa279a7f8b718db88414 (patch) | |
tree | 4179fa50abb2003e28b2b0b1707fd469314f6083 /src/main | |
parent | 20452d4d66d25b66bc820ed85f2596e0afe38a38 (diff) | |
download | skyhanni-18ffc756d1ed6da48e2bfa279a7f8b718db88414.tar.gz skyhanni-18ffc756d1ed6da48e2bfa279a7f8b718db88414.tar.bz2 skyhanni-18ffc756d1ed6da48e2bfa279a7f8b718db88414.zip |
code cleanup
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt index 0e9392ea0..e750245b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt @@ -23,7 +23,11 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult private var wasMouseButtonDown = false private val h = 300 private val reasonMaxLength = - history.maxOf { it.actionReason?.let { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it) } ?: 0 } + history.maxOf { reasonLength(it) } + + private fun reasonLength(result: ChatManager.MessageFilteringResult): Int = + result.actionReason?.let { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it) } ?: 0 + private val historySize by lazy { history.sumOf { splitLine(it.message).size * 10 + if (it.modified != null) splitLine(it.modified).size * 10 else 0 } } |