diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-07 20:55:50 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-07 20:55:50 +0200 |
commit | 6c113fc08517dc9781b93725816dda4cb043c12c (patch) | |
tree | fe8d2ac4d87d16f084c0a17fc0f6b9c3340a708a /src/main/java | |
parent | 9dc01ba47fc99e2a115f2304153973f02c45c061 (diff) | |
download | skyhanni-6c113fc08517dc9781b93725816dda4cb043c12c.tar.gz skyhanni-6c113fc08517dc9781b93725816dda4cb043c12c.tar.bz2 skyhanni-6c113fc08517dc9781b93725816dda4cb043c12c.zip |
add support for dynamic bingo ranks
Diffstat (limited to 'src/main/java')
4 files changed, 25 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index fd56e2bc0..df9171aa1 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.Features import at.hannibal2.skyhanni.config.SackData import at.hannibal2.skyhanni.config.commands.Commands.init import at.hannibal2.skyhanni.data.ActionBarStatsData +import at.hannibal2.skyhanni.data.BingoAPI import at.hannibal2.skyhanni.data.BlockData import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.data.CropAccessoryData @@ -361,6 +362,7 @@ class SkyHanniMod { loadModule(PurseAPI()) loadModule(RiftAPI) loadModule(SackAPI) + loadModule(BingoAPI) // features loadModule(BazaarOrderHelper()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt index 8eac5b720..ca2557af0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt @@ -1,17 +1,17 @@ package at.hannibal2.skyhanni.data -object BingoAPI { +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.jsonobjects.BingoRanks +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +object BingoAPI { private var ranks = mapOf<String, Int>() - init { - ranks = mapOf( - "§7Ⓑ" to 0, - "§aⒷ" to 1, - "§9Ⓑ" to 2, - "§5Ⓑ" to 3, - "§6Ⓑ" to 4, - ) + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + event.getConstant<BingoRanks>("BingoRanks")?.let { + ranks = it.ranks + } } fun getRank(text: String) = ranks.entries.find { text.contains(it.key) }?.value diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 012a76f1c..e8ca2ab3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -142,16 +142,10 @@ class HypixelData { bingo = false for (line in ScoreboardData.sidebarLinesFormatted) { + if (BingoAPI.getRank(line) != null) { + bingo = true + } when (line) { - " §7Ⓑ §7Bingo", // No Rank - " §aⒷ §aBingo", // Rank 1 - " §9Ⓑ §9Bingo", // Rank 2 - " §5Ⓑ §5Bingo", // Rank 3 - " §6Ⓑ §6Bingo", // Rank 4 - -> { - bingo = true - } - " §7♲ §7Ironman" -> { ironman = true } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java new file mode 100644 index 000000000..a7b7dbecc --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java @@ -0,0 +1,11 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.Map; + +public class BingoRanks { + @Expose + public Map<String, Integer> ranks; + +} |