aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index e38854ba3..b92647b9a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -188,7 +188,7 @@ class HypixelData {
bingo = false
for (line in ScoreboardData.sidebarLinesFormatted) {
- if (BingoAPI.getRank(line) != null) {
+ if (BingoAPI.getRankFromScoreboard(line) != null) {
bingo = true
}
when (line) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
index 599b4a306..282791154 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
@@ -9,7 +9,9 @@ import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal
import at.hannibal2.skyhanni.features.bingo.card.goals.GoalType
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.TimeUtils
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.time.LocalTime
import java.time.OffsetDateTime
@@ -24,12 +26,16 @@ object BingoAPI {
val communityGoals get() = bingoGoals.values.filter { it.type == GoalType.COMMUNITY }
var lastBingoCardOpenTime = SimpleTimeMark.farPast()
+ private val detectionPattern by RepoPattern.pattern("bingo.detection.scoreboard", " §.Ⓑ §.Bingo")
+
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
ranks = event.getConstant<BingoRanksJson>("BingoRanks").ranks
data = event.getConstant<BingoJson>("Bingo").bingo_tips
}
+ fun getRankFromScoreboard(text: String) = if (detectionPattern.matches(text)) getRank(text) else null
+
fun getRank(text: String) = ranks.entries.find { text.contains(it.key) }?.value
fun getIcon(searchRank: Int) = ranks.entries.find { it.value == searchRank }?.key