aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
diff options
context:
space:
mode:
authorMoo2meenn <67310794+Moo2meenn@users.noreply.github.com>2022-05-06 18:50:33 +0300
committerGitHub <noreply@github.com>2022-05-06 18:50:33 +0300
commitb96de6230299c751d0d3953c6546992efccb1111 (patch)
treed9db5ea005b8084b08c639096b42d3e5f6cc517e /src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
parent1046d78d70f074074dcf5c4ce522c8dc83654242 (diff)
parentdae58987b89bc01fa2828b5f4840a594f416f592 (diff)
downloadChatting-b96de6230299c751d0d3953c6546992efccb1111.tar.gz
Chatting-b96de6230299c751d0d3953c6546992efccb1111.tar.bz2
Chatting-b96de6230299c751d0d3953c6546992efccb1111.zip
Merge branch 'main' into fix-buttons-height
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
index 2cd4418..50de1f4 100644
--- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt
@@ -5,11 +5,13 @@ import com.google.gson.annotations.SerializedName
import net.minecraft.client.Minecraft
import net.minecraft.util.EnumChatFormatting
import net.minecraft.util.IChatComponent
+import java.util.*
data class ChatTab(
val enabled: Boolean,
val name: String,
val unformatted: Boolean,
+ val lowercase: Boolean?,
@SerializedName("starts") val startsWith: List<String>?,
val contains: List<String>?,
@SerializedName("ends") val endsWith: List<String>?,
@@ -23,7 +25,7 @@ data class ChatTab(
val color: Int?,
@SerializedName("hovered_color") val hoveredColor: Int?,
@SerializedName("selected_color") val selectedColor: Int?,
- val prefix: String,
+ val prefix: String?,
) {
lateinit var button: TabButton
lateinit var compiledRegex: ChatRegexes
@@ -43,7 +45,11 @@ data class ChatTab(
fun shouldRender(chatComponent: IChatComponent): Boolean {
val message =
- if (unformatted) EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.unformattedText) else chatComponent.formattedText
+ (if (unformatted) EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.unformattedText) else chatComponent.formattedText).let {
+ if (lowercase == true) it.lowercase(
+ Locale.ENGLISH
+ ) else it
+ }
ignoreStartsWith?.forEach {
if (message.startsWith(it)) {
return false