Skip to content

Commit

Permalink
Fix: Bazaar showing Minion XP
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 committed Dec 9, 2023
1 parent 8aee227 commit b35e6bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SpecialColour
import at.hannibal2.skyhanni.utils.StringUtils.find
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.TimeUtils
Expand Down Expand Up @@ -64,7 +65,7 @@ class MinionFeatures {
private var coinsPerDay = ""
private val minionUpgradePattern by RepoPattern.pattern("minion.chat.upgrade", "§aYou have upgraded your Minion to Tier (?<tier>.*)")
private val minionCoinPattern by RepoPattern.pattern("minion.chat.coin", "§aYou received §r§6(.*) coins§r§a!")
private val minionTitlePattern by RepoPattern.pattern("minion.title", "Minion ")
private val minionTitlePattern by RepoPattern.pattern("minion.title", "Minion [^➜]")
private val minionCollectItemPattern by RepoPattern.pattern("minion.item.collect", "^§aCollect All$")

@SubscribeEvent
Expand Down Expand Up @@ -129,7 +130,7 @@ class MinionFeatures {
@SubscribeEvent
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
if (!enableWithHub()) return
if (!minionTitlePattern.matches(event.inventoryName)) return
if (!minionTitlePattern.find(event.inventoryName)) return

event.inventoryItems[48]?.let {
if (minionCollectItemPattern.matches(it.name ?: "")) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,6 @@ object StringUtils {
}

fun Pattern.matches(string: String) = matcher(string).matches()

fun Pattern.find(string: String) = matcher(string).find()
}

0 comments on commit b35e6bb

Please sign in to comment.