blob: 5b32a1d15d6852d81b1292368b0bfe816e5a5c66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.jsonobjects.BingoRanksJson
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object BingoAPI {
private var ranks = mapOf<String, Int>()
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
ranks = event.getConstant<BingoRanksJson>("BingoRanks").ranks
}
fun getRank(text: String) = ranks.entries.find { text.contains(it.key) }?.value
fun getIcon(searchRank: Int) = ranks.entries.find { it.value == searchRank }?.key
}
|