diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index ff744cecd..1e991605e 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -14,13 +14,25 @@ import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class CollectionAPI { - - // TODO USE SH-REPO - private val counterPattern = ".* §e(?<amount>.*)§6/.*".toPattern() - private val singleCounterPattern = "§7Total Collected: §e(?<amount>.*)".toPattern() +object CollectionAPI { + private val patternGroup = RepoPattern.group("data.collection.api") + private val counterPattern by patternGroup.pattern( + "counter", + ".* §e(?<amount>.*)§6/.*" + ) + private val singleCounterPattern by patternGroup.pattern( + "singlecounter", + "§7Total Collected: §e(?<amount>.*)" + ) + private val collectionTier0Pattern by patternGroup.pattern( + "tierzero", + "§7Progress to .* I: .*" + ) + + val collectionValue = mutableMapOf<NEUInternalName, Long>() @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { @@ -83,14 +95,6 @@ class CollectionAPI { collectionValue.addOrPut(internalName, event.amount.toLong()) } - companion object { - - // TODO USE SH-REPO - val collectionValue = mutableMapOf<NEUInternalName, Long>() - private val collectionTier0Pattern = "§7Progress to .* I: .*".toPattern() - - fun isCollectionTier0(lore: List<String>) = lore.any { collectionTier0Pattern.matches(it) } - - fun getCollectionCounter(internalName: NEUInternalName): Long? = collectionValue[internalName] - } + fun isCollectionTier0(lore: List<String>) = lore.any { collectionTier0Pattern.matches(it) } + fun getCollectionCounter(internalName: NEUInternalName): Long? = collectionValue[internalName] } |
