aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/dungeon/DungeonBossMessages.kt
blob: 0dbfbd73247ac6e91eb532cf27da682fe85a561c (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
44
45
46
47
48
49
50
51
package at.hannibal2.skyhanni.dungeon

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.matchRegex
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

class DungeonBossMessages {

    @SubscribeEvent
    fun onChatMessage(event: LorenzChatEvent) {
        if (!LorenzUtils.inSkyblock) return

        if (!SkyHanniMod.feature.chat.dungeonBossMessages) return

        if (isBoss(event.message)) {
            event.blockedReason = "dungeon_boss"
        }
    }

    private fun isBoss(message: String): Boolean {
        when {
            message.matchRegex("§([cd4])\\[BOSS] (.*)") -> {
                when {
                    message.contains(" The Watcher§r§f: ") -> return true
                    message.contains(" Bonzo§r§f: ") -> return true
                    message.contains(" Scarf§r§f:") -> return true
                    message.contains("Professor§r§f") -> return true
                    message.contains(" Livid§r§f: ") || message.contains(" Enderman§r§f: ") -> return true
                    message.contains(" Thorn§r§f: ") -> return true
                    message.contains(" Sadan§r§f: ") -> return true
                    message.contains(" Maxor§r§c: ") -> return true
                    message.contains(" Storm§r§c: ") -> return true
                    message.contains(" Goldor§r§c: ") -> return true
                    message.contains(" Necron§r§c: ") -> return true
                    message.contains(" §r§4§kWither King§r§c:") -> return true

                    message.endsWith(" Necron§r§c: That is enough, fool!") -> return true
                    message.endsWith(" Necron§r§c: Adventurers! Be careful of who you are messing with..") -> return true
                    message.endsWith(" Necron§r§c: Before I have to deal with you myself.") -> return true
                }
            }

            //M7 - Dragons
            message == "§cThe Crystal withers your soul as you hold it in your hands!" -> return true
            message == "§cIt doesn't seem like that is supposed to go there." -> return true
        }
        return false
    }
}