blob: 884e4cc9f572a81b58bd8926917870d952f7ac83 (
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.AbiphoneDND
import dulkirmod.features.chat.Bridge
import dulkirmod.features.chat.FakeMsg
import dulkirmod.features.chat.ThrottleNotif
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)
}
}
|