aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/events/ChatEvent.kt
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-10-28 12:17:26 -0500
committeringle <inglettronald@gmail.com>2022-10-28 12:17:26 -0500
commitbfa2b37155711e2a907f15d6e56d18378ae4f723 (patch)
treeffae5faade666c6ed631f8f8c438def680c9fc27 /src/main/kotlin/dulkirmod/events/ChatEvent.kt
parentfba8ecf8f06c03c36c8d4823fe5e5928bad98d32 (diff)
downloadDulkirMod-bfa2b37155711e2a907f15d6e56d18378ae4f723.tar.gz
DulkirMod-bfa2b37155711e2a907f15d6e56d18378ae4f723.tar.bz2
DulkirMod-bfa2b37155711e2a907f15d6e56d18378ae4f723.zip
+ Efficiency improvements
+ command for setting leap highlight + (I THINK) abiphone dnd (on by default)
Diffstat (limited to 'src/main/kotlin/dulkirmod/events/ChatEvent.kt')
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
index 290372a..3bddaea 100644
--- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt
+++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt
@@ -13,7 +13,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ChatEvent {
private val guildFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+) > .+".toRegex()
private val alternateFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+): .+".toRegex()
- private var lastThrottle : Long = 0;
+ private var lastThrottle : Long = 0
+ private var lastRing : Long = 0
+
@SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
fun onChat(event: ClientChatReceivedEvent) {
if (event.type == 2.toByte()) {
@@ -66,5 +68,16 @@ class ChatEvent {
).setChatStyle(event.message.siblings[1].chatStyle.createShallowCopy())
}
}
+
+ // DO NOT DISTURB FOR ABIPHONE
+ if (unformatted.equals("✆ \\w+ ✆".toRegex())) {
+ DulkirMod.mc.thePlayer.addChatMessage(
+ ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Call blocked!")
+ )
+ event.isCanceled = true;
+ lastRing = System.currentTimeMillis()
+ }
+ if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]") && System.currentTimeMillis() - lastRing < 4000)
+ event.isCanceled = true;
}
} \ No newline at end of file