aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2023-12-09 22:21:10 +0100
committerGitHub <noreply@github.com>2023-12-09 22:21:10 +0100
commitbeb9d2367991633a6ba2d5b2b4b5601753e2e998 (patch)
tree95fcb86ec76591671dbf9c438ca8957812e41f99 /src/main
parent6178599f6be4fed791b7e5080564a38626ad0a61 (diff)
downloadskyhanni-beb9d2367991633a6ba2d5b2b4b5601753e2e998.tar.gz
skyhanni-beb9d2367991633a6ba2d5b2b4b5601753e2e998.tar.bz2
skyhanni-beb9d2367991633a6ba2d5b2b4b5601753e2e998.zip
Fix: Bazaar showing Minion XP (#785)
Fixed showing Minion XP display in Bazaar. #785
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt2
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index 5fc4474d9..9aee4035d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -33,10 +33,12 @@ 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
import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
@@ -61,12 +63,14 @@ class MinionFeatures {
private var lastInventoryClosed = 0L
private var coinsPerDay = ""
- private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (?<tier>.*)".toPattern()
- private val minionCoinPattern = "§aYou received §r§6(.*) coins§r§a!".toPattern()
+ 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 minionCollectItemPattern by RepoPattern.pattern("minion.item.collect", "^§aCollect All$")
@SubscribeEvent
fun onPlayerInteract(event: PlayerInteractEvent) {
- if (!enableWithHub()) return
+ if (!enable()) return
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return
val lookingAt = event.pos.offset(event.face).toLorenzVec()
@@ -126,10 +130,10 @@ class MinionFeatures {
@SubscribeEvent
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
if (!enableWithHub()) return
- if (!event.inventoryName.contains("Minion ")) return
+ if (!minionTitlePattern.find(event.inventoryName)) return
event.inventoryItems[48]?.let {
- if ("§aCollect All" == it.name) {
+ if (minionCollectItemPattern.matches(it.name ?: "")) {
MinionOpenEvent(event.inventoryName, event.inventoryItems).postAndCatch()
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
index cb7a0fa23..5cde8f6f9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
@@ -263,4 +263,6 @@ object StringUtils {
}
fun Pattern.matches(string: String) = matcher(string).matches()
+
+ fun Pattern.find(string: String) = matcher(string).find()
}