aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/MatchoAlert.kt
blob: c1400364563f69aa6c1cd3bd45d1aa0010437778 (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
38
39
40
41
42
43
package dulkirmod.features

import dulkirmod.DulkirMod
import dulkirmod.config.Config
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils

class MatchoAlert {

    var hasSentAlert = false

    fun alert() {
        if (!Config.notifyMatcho) return
        if (!Utils.isInSkyblock()) return

        val scoreboardList: List<String?> = TabListUtils.fetchTabEntires().map {
            it.displayName?.unformattedText
        }

        var explo = false
        for (s in scoreboardList) {
            if (explo) {
                // This line is status of Volcano
                if (s != " INACTIVE" && !hasSentAlert) {
                    val color = Utils.getColorString(Config.bestiaryNotifColor)
                    DulkirMod.titleUtils.drawStringForTime("${color}Matcho", 5000)
                    if (Config.bestiaryAlertSounds)
                        DulkirMod.mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f)
                    hasSentAlert = true
                } else if (s == " INACTIVE") hasSentAlert = false
                break
            }
            if (s == "Volcano Explosivity:")
                explo = true
            if (s != null) {
                if (s.contains("Area:") && !s.contains("Crimson Isle")) {
                    hasSentAlert = false
                    break
                }
            }
        }
    }
}