aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-21 01:42:46 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-21 01:42:46 +0100
commitb6d939ade1289e7e6170ceaeaaa03658e1439283 (patch)
treece4cdb55c7332cce021644d96b8146eb5bc180e3 /src/main/java
parent3a309af2d544a98080645143dcef36dfd1b5633b (diff)
downloadskyhanni-b6d939ade1289e7e6170ceaeaaa03658e1439283.tar.gz
skyhanni-b6d939ade1289e7e6170ceaeaaa03658e1439283.tar.bz2
skyhanni-b6d939ade1289e7e6170ceaeaaa03658e1439283.zip
Fixed /gfs command counting to slayer profit tracker.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
index a7b31159b..97065766e 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent
@@ -9,10 +10,13 @@ import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.Minecraft
import net.minecraft.network.play.server.S0DPacketCollectItem
import net.minecraft.network.play.server.S2FPacketSetSlot
@@ -24,6 +28,10 @@ import kotlin.time.Duration.Companion.milliseconds
class OwnInventoryData {
private var itemAmounts = mapOf<NEUInternalName, Int>()
private var dirty = false
+ private val sackToInventoryChatPattern by RepoPattern.pattern(
+ "data.owninventory.chat.movedsacktoinventory",
+ "§aMoved §r§e\\d* (?<name>.*)§r§a from your Sacks to your inventory."
+ )
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
fun onChatPacket(event: PacketEvent.ReceiveEvent) {
@@ -96,6 +104,14 @@ class OwnInventoryData {
ignoreItem(500.milliseconds) { true }
}
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ sackToInventoryChatPattern.matchMatcher(event.message) {
+ val name = group("name")
+ ignoreItem(500.milliseconds) { it.getItemName().contains(name) }
+ }
+ }
+
private fun ignoreItem(duration: Duration, condition: (NEUInternalName) -> Boolean) {
ignoredItemsUntil.add(IgnoredItem(condition, SimpleTimeMark.now() + duration))
}
@@ -109,7 +125,10 @@ class OwnInventoryData {
if (diffWorld < 3_000) return
ignoredItemsUntil.removeIf { it.blockedUntil.isInPast() }
- if (ignoredItemsUntil.any { it.condition(internalName) }) return
+ if (ignoredItemsUntil.any { it.condition(internalName) }) {
+// println("ignored: $internalName")
+ return
+ }
if (internalName.startsWith("MAP-")) return