diff options
author | ingle <inglettronald@gmail.com> | 2022-10-27 17:49:49 -0500 |
---|---|---|
committer | ingle <inglettronald@gmail.com> | 2022-10-27 17:49:49 -0500 |
commit | fba8ecf8f06c03c36c8d4823fe5e5928bad98d32 (patch) | |
tree | 9983636402355e7e32f294c5e25b01471173e96c /src/main/kotlin/dulkirmod/events/ChatEvent.kt | |
parent | d2eb0ada9182f9cd507cd32b74cb72f62355acaa (diff) | |
download | DulkirMod-fba8ecf8f06c03c36c8d4823fe5e5928bad98d32.tar.gz DulkirMod-fba8ecf8f06c03c36c8d4823fe5e5928bad98d32.tar.bz2 DulkirMod-fba8ecf8f06c03c36c8d4823fe5e5928bad98d32.zip |
+ Added hide dungeon loot option
= updated throttle notifier to have some more options
Diffstat (limited to 'src/main/kotlin/dulkirmod/events/ChatEvent.kt')
-rw-r--r-- | src/main/kotlin/dulkirmod/events/ChatEvent.kt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/events/ChatEvent.kt b/src/main/kotlin/dulkirmod/events/ChatEvent.kt index e034996..290372a 100644 --- a/src/main/kotlin/dulkirmod/events/ChatEvent.kt +++ b/src/main/kotlin/dulkirmod/events/ChatEvent.kt @@ -2,6 +2,7 @@ package dulkirmod.events import dulkirmod.DulkirMod import dulkirmod.config.Config +import dulkirmod.utils.Utils import dulkirmod.utils.Utils.stripColorCodes import net.minecraft.util.ChatComponentText import net.minecraft.util.EnumChatFormatting @@ -12,6 +13,7 @@ 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; @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) fun onChat(event: ClientChatReceivedEvent) { if (event.type == 2.toByte()) { @@ -20,9 +22,16 @@ class ChatEvent { // THROTTLE NOTIFIER val unformatted = stripColorCodes(event.message.unformattedText) - if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier) { + if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier + && Utils.isInDungeons()) { event.isCanceled = true; - DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + if (!Config.throttleNotifierSpam && System.currentTimeMillis() - lastThrottle > 5000) { + DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + } + else { + DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) + } + lastThrottle = System.currentTimeMillis() } // BRIDGE BOT STUFF - CLICKABLE LINKS! |