aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-01 14:58:22 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-01 14:58:22 +0100
commit6210bbc52d156b5b8a1557e90744f69de7dbcf7f (patch)
treea0958d72d5e7703b441d94e67c5206a7934b21b6 /src
parentb73dc04ab3e1a84406d9a6564ca628b29fc555e1 (diff)
downloadskyhanni-6210bbc52d156b5b8a1557e90744f69de7dbcf7f.tar.gz
skyhanni-6210bbc52d156b5b8a1557e90744f69de7dbcf7f.tar.bz2
skyhanni-6210bbc52d156b5b8a1557e90744f69de7dbcf7f.zip
Fixed detecting bingo profile while visiting other players bingo island.
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