aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/AlarmClock.kt
blob: 4792259274a35c2c4d293080edc5871d9fd2533e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package dulkirmod.features

import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.DulkirConfig
import dulkirmod.utils.ScoreBoardUtils
import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils

var lastUpdate: Long = 0

fun alarmClock() {
    // CHECK IF IN SKYBLOCK
    if (!Utils.isInSkyblock()) return
    // CHECK TIME
    val currTime: Long = System.currentTimeMillis()
    val lines = ScoreBoardUtils.getLines()
    for (l in lines) {
        // ZOMBIE VILLAGER
        if (DulkirConfig.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) {
            lastUpdate = currTime
            val color = Utils.getColorString(DulkirConfig.bestiaryNotifColor)
            TitleUtils.drawStringForTime("${color}Zombie Villager", 5000)
            if (DulkirConfig.bestiaryAlertSounds)
                mc.thePlayer.playSound("mob.villager.yes", 1f * DulkirConfig.bestiaryNotifVol, 0f)
        }
        // GHASTS
        else if (DulkirConfig.notifyGhast && l.contains("9:00pm") && (currTime - lastUpdate) > 15000) {
            lastUpdate = currTime
            val color = Utils.getColorString(DulkirConfig.bestiaryNotifColor)
            TitleUtils.drawStringForTime("${color}Ghast", 5000)
            if (DulkirConfig.bestiaryAlertSounds)
                mc.thePlayer.playSound("mob.ghast.scream", 1f * DulkirConfig.bestiaryNotifVol, 1f)
        }

    }

}