diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-04-18 17:26:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 17:26:24 +0200 |
commit | 3d0d4dd8e1dd49bcb3e1b607e0bc7cd5614299ad (patch) | |
tree | 96f05e1c7f059d4b0d6990b5b751ad4a1ecd0071 /src/main/java/at/hannibal2 | |
parent | f22e2beceb2d0fbcc16eff8b6271583089c5e29a (diff) | |
download | skyhanni-3d0d4dd8e1dd49bcb3e1b607e0bc7cd5614299ad.tar.gz skyhanni-3d0d4dd8e1dd49bcb3e1b607e0bc7cd5614299ad.tar.bz2 skyhanni-3d0d4dd8e1dd49bcb3e1b607e0bc7cd5614299ad.zip |
FIx: bazaar cancelled buy order v2 (#1474)
Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt index 3e55f93ac..61381bc7e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.inventory.bazaar import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.matchFirst import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -20,7 +21,7 @@ class BazaarCancelledBuyOrderClipboard { private val patternGroup = RepoPattern.group("bazaar.cancelledorder") /** - * REGEX-TEST: §6§7from §a59§7x §7missing items. + * REGEX-TEST: §6§7from §a50§7x §7missing items. */ private val lastAmountPattern by patternGroup.pattern( "lastamount", @@ -30,14 +31,18 @@ class BazaarCancelledBuyOrderClipboard { "cancelledmessage", "§6\\[Bazaar] §r§7§r§cCancelled! §r§7Refunded §r§6(?<coins>.*) coins §r§7from cancelling Buy Order!" ) + private val inventoryTitlePattern by patternGroup.pattern( + "inventorytitle", + "Order options" + ) private var latestAmount: Int? = null @SubscribeEvent - fun onTooltip(event: LorenzToolTipEvent) { + fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return - - val stack = event.itemStack + if (!inventoryTitlePattern.matches(event.inventoryName)) return + val stack = event.inventoryItems[11] ?: return if (!stack.name.contains("Cancel Order")) return stack.getLore().matchFirst(lastAmountPattern) { @@ -49,7 +54,7 @@ class BazaarCancelledBuyOrderClipboard { fun onChat(event: LorenzChatEvent) { if (!isEnabled()) return val coins = cancelledMessagePattern.matchMatcher(event.message) { - group("coins") + group("coins").formatInt().addSeparators() } ?: return val latestAmount = latestAmount ?: error("latest amount is null") |