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

import net.minecraft.client.Minecraft
import net.minecraft.util.ChatComponentText
import net.minecraftforge.client.event.ClientChatReceivedEvent

object FakeMsg {
    fun handle(event: ClientChatReceivedEvent, unformatted: String) {
        if (unformatted.startsWith("From [MVP++] Dulkir: c:")) {
            event.isCanceled = true
            val newst = unformatted.substring("From [MVP++] Dulkir: c:".length)
            Minecraft.getMinecraft().thePlayer.addChatMessage(ChatComponentText(newst.replace("&", "§")))
        }
        if (unformatted.startsWith("From [MVP+] Dulkir: c:")) {
            event.isCanceled = true
            val newst = unformatted.substring("From [MVP+] Dulkir: c:".length)
            Minecraft.getMinecraft().thePlayer.addChatMessage(ChatComponentText(newst.replace("&", "§")))
        }
    }
}