diff options
author | inglettronald <inglettronald@gmail.com> | 2023-02-28 18:07:08 -0600 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-02-28 18:07:08 -0600 |
commit | 890f44737371973c2c339292c1279b1ee1858357 (patch) | |
tree | 10343d16a0e663e845061ab0f155815d36cdd33d /src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt | |
parent | f8e29c3a1b18aa0587f102167ab5f6b5a43a5607 (diff) | |
download | DulkirMod-890f44737371973c2c339292c1279b1ee1858357.tar.gz DulkirMod-890f44737371973c2c339292c1279b1ee1858357.tar.bz2 DulkirMod-890f44737371973c2c339292c1279b1ee1858357.zip |
added persistent visitor alert
Diffstat (limited to 'src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt')
-rw-r--r-- | src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt index 1292b7e..b3113bd 100644 --- a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt +++ b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt @@ -6,7 +6,8 @@ import dulkirmod.utils.TabListUtils import dulkirmod.utils.Utils class GardenVisitorAlert { - var hasSentAlert = false + private var hasSentAlert = false + private var lastAlert = 0 fun alert() { if (!Config.notifyMaxVisitors) return @@ -19,10 +20,23 @@ class GardenVisitorAlert { if (TabListUtils.maxVisitors && !hasSentAlert) { val color = Utils.getColorString(Config.bestiaryNotifColor) DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000) - DulkirMod.mc.thePlayer.playSound("mob.cat.meow", 1f * Config.bestiaryNotifVol, 1f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f) hasSentAlert = true + lastAlert = System.currentTimeMillis().toInt() } else if (!TabListUtils.maxVisitors) hasSentAlert = false + val timeSinceLastAlert = System.currentTimeMillis().toInt() - lastAlert + + if (TabListUtils.maxVisitors && hasSentAlert && timeSinceLastAlert > 5000 && Config.persistentAlert) { + lastAlert = System.currentTimeMillis().toInt() + val color = Utils.getColorString(Config.bestiaryNotifColor) + DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f) + } } }
\ No newline at end of file |