aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/dulkirmod/events')
-rw-r--r--src/main/kotlin/dulkirmod/events/ChatEvent.kt15
-rw-r--r--src/main/kotlin/dulkirmod/events/caller.txt4
2 files changed, 18 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
diff --git a/src/main/kotlin/dulkirmod/events/caller.txt b/src/main/kotlin/dulkirmod/events/caller.txt
new file mode 100644
index 0000000..75ec9e9
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/events/caller.txt
@@ -0,0 +1,4 @@
+✆ Aranya ✆
+§a✆ Ring... §2§l[PICK UP]
+§a✆ Ring... Ring... §2§l[PICK UP]
+§a✆ Ring... Ring... Ring... §2§l[PICK UP] \ No newline at end of file