aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/features/MatchoAlert.kt
blob: 1b2bb7a838affe7ce115ab2fbc9712ae9ea89955 (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
package dulkirmod.features

import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.DulkirConfig
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.TitleUtils
import dulkirmod.utils.Utils
import net.minecraft.client.audio.SoundCategory

object MatchoAlert {

    var hasSentAlert = false

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

        if (TabListUtils.area != "Crimson Isle") {
            hasSentAlert = false
        }

        if (TabListUtils.explosivity && !hasSentAlert) {
            val color = Utils.getColorString(DulkirConfig.bestiaryNotifColor)
            TitleUtils.drawStringForTime("${color}Matcho", 5000)
            if (DulkirConfig.bestiaryAlertSounds) {
                val prevVol = mc.gameSettings.getSoundLevel(SoundCategory.MOBS)
                mc.gameSettings.setSoundLevel(SoundCategory.MOBS, 1f)
                mc.thePlayer.playSound("mob.villager.yes", 1f * DulkirConfig.bestiaryNotifVol, 0f)
                mc.gameSettings.setSoundLevel(SoundCategory.MOBS, prevVol)
            }
            hasSentAlert = true
        } else if (!TabListUtils.explosivity) hasSentAlert = false
    }
}