aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/events/ChatEvent.kt
blob: 1b0f232ed7f544648e116c01d369b96461b125f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package dulkirmod.events

import dulkirmod.features.chat.*
import dulkirmod.utils.Utils.stripColorCodes
import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class ChatEvent {

    /**
     * This is mostly the way it is to avoid having to run strip color codes a bunch of times
     * for each message. Not sure if it even matters but whatever
     */
    @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
    fun onChat(event: ClientChatReceivedEvent) {
        if (event.type == 2.toByte()) {
            return
        }
        val unformatted = stripColorCodes(event.message.unformattedText)

        // THROTTLE NOTIFIER
        ThrottleNotif.handle(event, unformatted)

        // BRIDGE BOT STUFF - CLICKABLE LINKS!
        Bridge.handle(event)

        // DO NOT DISTURB FOR ABIPHONE
        AbiphoneDND.handle(event, unformatted)

        // FAKE MESSAGE SENDER (DULKIR ONLY)
        FakeMsg.handle(event, unformatted)

        // Quick vanquisher thing
        VanquisherTrigger.handle(unformatted)
    }
}