aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
blob: ca78dae0b6a1f43124b54d9d0b5d793427ae4166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package dulkirmod.features.chat

import dulkirmod.utils.TextUtils
import net.minecraftforge.client.event.ClientChatReceivedEvent

object FakeMsg {
    private val dulkirRegex = "^From \\[MVP(\\+|\\+\\+)] Dulkir: c:".toRegex()
    fun handle(event: ClientChatReceivedEvent, unformatted: String) {
        if (unformatted.contains(dulkirRegex)) {
            event.isCanceled = true
            val message = unformatted.replace(dulkirRegex, "").replace("&", "§").trim()
            TextUtils.info(message, false)
        }
    }
}