diff options
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 |