aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-17 12:15:40 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-17 12:15:40 +0100
commitaee1bd5207a3193d05068fc046ef01e06fc1be67 (patch)
tree455b19c0767b14aac037297c7c5063c8a6462f7f /src/main/java
parent18e96e6c3b867da06aabd29bcd83e92ffe58a00e (diff)
downloadskyhanni-aee1bd5207a3193d05068fc046ef01e06fc1be67.tar.gz
skyhanni-aee1bd5207a3193d05068fc046ef01e06fc1be67.tar.bz2
skyhanni-aee1bd5207a3193d05068fc046ef01e06fc1be67.zip
Fixed opening the Pet menu no longer updating current pet display.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt8
2 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt
index c21b2f384..9c5eac610 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/PetAPI.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data
object PetAPI {
+ // Contains color code + name and for older SkyHanni users maybe also the pet level
var currentPet: String?
get() = ProfileStorageData.profileSpecific?.currentPet
set(value) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt
index 7855a94b9..128e9a126 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt
@@ -18,7 +18,8 @@ class CurrentPetDisplay {
private val config get() = SkyHanniMod.feature.misc.pets
// TODO USE SH-REPO
- private val inventoryNamePattern = "(?:\\(\\d+/\\d+\\))? Pets".toPattern()
+ private val inventoryNamePattern = "Pets( \\(\\d+/\\d+\\) )?".toPattern()
+ private val inventorySelectedPetPattern = "§7§7Selected pet: (?<pet>.*)".toPattern()
private val chatSpawnPattern = "§aYou summoned your §r(?<pet>.*)§r§a!".toPattern()
private val chatDespawnPattern = "§aYou despawned your §r.*§r§a!".toPattern()
private val chatPetRulePattern = "§cAutopet §eequipped your §7\\[Lvl .*] (?<pet>.*)! §a§lVIEW RULE".toPattern()
@@ -49,12 +50,11 @@ class CurrentPetDisplay {
@SubscribeEvent
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
- if (!inventoryNamePattern.matcher(event.inventoryName).matches()) return
+ if (!inventoryNamePattern.matches(event.inventoryName)) return
val lore = event.inventoryItems[4]?.getLore() ?: return
- val selectedPetPattern = "§7§7Selected pet: (?<pet>.*)".toPattern()
for (line in lore) {
- selectedPetPattern.matchMatcher(line) {
+ inventorySelectedPetPattern.matchMatcher(line) {
val newPet = group("pet")
PetAPI.currentPet = if (newPet != "§cNone") newPet else ""
}