From 393d4c8e14730a5c9b31695f722b6de9480508ec Mon Sep 17 00:00:00 2001 From: ingle Date: Sat, 29 Oct 2022 12:12:03 -0500 Subject: + abiphone do not disturb = refactored chatevent code for readability --- src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt (limited to 'src/main/kotlin/dulkirmod/features/chat/FakeMsg.kt') 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 -- cgit