blob: de180fa0feae6bebeb14eb71371e4d4b51cd0c48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package dulkirmod.events
import dulkirmod.DulkirMod
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 {
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
fun onChat(event: ClientChatReceivedEvent) {
if (event.type == 2.toByte()) {
return
}
val unformatted = stripColorCodes(event.message.unformattedText)
if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier) {
event.isCanceled = true;
DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage)
}
}
}
|