aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-10-29 12:12:03 -0500
committeringle <inglettronald@gmail.com>2022-10-29 12:12:03 -0500
commit393d4c8e14730a5c9b31695f722b6de9480508ec (patch)
treef8c9c1143e17e8578cc1567d3a464e219459f69f /src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
parent798b38e5f3579469192916b69427ce46127deead (diff)
downloadDulkirMod-393d4c8e14730a5c9b31695f722b6de9480508ec.tar.gz
DulkirMod-393d4c8e14730a5c9b31695f722b6de9480508ec.tar.bz2
DulkirMod-393d4c8e14730a5c9b31695f722b6de9480508ec.zip
+ abiphone do not disturb
= refactored chatevent code for readability
Diffstat (limited to 'src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt')
-rw-r--r--src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt b/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
new file mode 100644
index 0000000..f73572e
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt
@@ -0,0 +1,20 @@
+package dulkirmod.features.chat
+
+import net.minecraft.client.Minecraft
+import net.minecraft.util.ChatComponentText
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+
+object FakeMsg {
+ fun handle(event: ClientChatReceivedEvent, unformatted: String) {
+ if (unformatted.startsWith("From [MVP++] Dulkir: c:")) {
+ event.isCanceled = true
+ val newst = unformatted.substring("From [MVP++] Dulkir: c:".length)
+ Minecraft.getMinecraft().thePlayer.addChatMessage(ChatComponentText(newst.replace("&", "§")))
+ }
+ if (unformatted.startsWith("From [MVP+] Dulkir: c:")) {
+ event.isCanceled = true
+ val newst = unformatted.substring("From [MVP+] Dulkir: c:".length)
+ Minecraft.getMinecraft().thePlayer.addChatMessage(ChatComponentText(newst.replace("&", "§")))
+ }
+ }
+} \ No newline at end of file