aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/events/ChatEvent.kt
blob: 52026e907731d8afc260fe2a99a823f9e42b5b78 (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
38
39
40
41
42
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

object 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)

        // Key Hud Element
        DungeonKeyDisplay.handle(unformatted)

        DoubleHookDing.handle(event, unformatted)
    }
}