aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-10-10 17:33:57 -0500
committeringle <inglettronald@gmail.com>2022-10-10 17:33:57 -0500
commitbb0a6799a67e3bed3f78948b2dc5711c668e1c4f (patch)
treeb058099da8617f12d2f1023c40148ac694598158 /src/main
parentc933a10ff922e00a45b1e01028ccf970094f9dbe (diff)
downloadDulkirMod-bb0a6799a67e3bed3f78948b2dc5711c668e1c4f.tar.gz
DulkirMod-bb0a6799a67e3bed3f78948b2dc5711c668e1c4f.tar.bz2
DulkirMod-bb0a6799a67e3bed3f78948b2dc5711c668e1c4f.zip
+ add Arachne Boss Kill timer
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt6
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt8
-rw-r--r--src/main/kotlin/dulkirmod/features/ArachneTimer.kt42
3 files changed, 54 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 85d89aa..350c4ae 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -3,6 +3,7 @@ package dulkirmod
import dulkirmod.command.*
import dulkirmod.config.Config
import dulkirmod.events.ChatEvent
+import dulkirmod.features.ArachneTimer
import dulkirmod.features.NametagCleaner
import dulkirmod.features.alarmClock
import dulkirmod.features.brokenHypeNotif
@@ -60,6 +61,7 @@ class DulkirMod {
MinecraftForge.EVENT_BUS.register(ChatEvent())
MinecraftForge.EVENT_BUS.register(NametagCleaner)
MinecraftForge.EVENT_BUS.register(DulkirMod.titleUtils)
+ MinecraftForge.EVENT_BUS.register(ArachneTimer())
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
@@ -102,8 +104,8 @@ class DulkirMod {
companion object {
const val MOD_ID = "dulkirmod"
const val MOD_NAME = "Dulkir Mod"
- const val MOD_VERSION = "1.0.6"
- const val CHAT_PREFIX = "<DulkirMod>"
+ const val MOD_VERSION = "1.0.7"
+ const val CHAT_PREFIX = "§f<§3DulkirMod§f>"
val mc: Minecraft = Minecraft.getMinecraft()
var config = Config
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index f38257c..1a88d1a 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -388,6 +388,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
category = "Bestiary"
)
var hideArachneTags = false
+
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Arachne kill timer",
+ description = "Shows in chat.",
+ category = "Bestiary"
+ )
+ var arachneKillTimer = false
fun init() {
initialize()
addDependency("customMessage", "throttleNotifier")
diff --git a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
new file mode 100644
index 0000000..7e0f144
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt
@@ -0,0 +1,42 @@
+package dulkirmod.features
+
+import dulkirmod.DulkirMod
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import dulkirmod.utils.Utils
+import net.minecraft.util.ChatComponentText
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class ArachneTimer {
+ private var startmillis : Long = -1;
+ private var endmillis : Long = -1;
+
+ @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW)
+ fun onChat(event: ClientChatReceivedEvent) {
+ if (!Config.arachneKillTimer) return
+
+ var killtime : Float = -1f;
+
+ if (event.type == 2.toByte()) {
+ return
+ }
+
+ val unformatted = Utils.stripColorCodes(event.message.unformattedText)
+ if (unformatted == "[BOSS] Arachne: You dare to call me, the queen of the dark, to you. I'll accept no excuses, you shall die!") {
+ startmillis = System.currentTimeMillis()
+ }
+
+ if (unformatted == "[BOSS] Arachne: You are lucky this time that you only called out a portion of my power. If you dared to face me at my peak, you would not survive!") {
+ endmillis = System.currentTimeMillis()
+ if (startmillis > -1) {
+ killtime = (endmillis - startmillis).toFloat() / 1000
+
+ mc.thePlayer.addChatMessage(
+ ChatComponentText("${DulkirMod.CHAT_PREFIX} §6Arachne took §7$killtime §6seconds to kill.")
+ )
+ }
+ }
+ }
+} \ No newline at end of file