summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/mining
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-09-07 07:05:45 +0200
committerGitHub <noreply@github.com>2024-09-07 07:05:45 +0200
commit02c9ce15e053d5d0751c32ea3ef481c9eef7a904 (patch)
treeee7f200d2e4ba2555aaa54b336d3d0ecbc47558f /src/main/java/at/hannibal2/skyhanni/features/mining
parent78ce109b8fe6291340067771217b6965d82d76c2 (diff)
downloadskyhanni-02c9ce15e053d5d0751c32ea3ef481c9eef7a904.tar.gz
skyhanni-02c9ce15e053d5d0751c32ea3ef481c9eef7a904.tar.bz2
skyhanni-02c9ce15e053d5d0751c32ea3ef481c9eef7a904.zip
Feature: /shedittracker (#2448)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/mining')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
index dcf9b8c4d..ef3b780b7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt
@@ -2,8 +2,10 @@ package at.hannibal2.skyhanni.features.mining.fossilexcavator
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.ItemAddManager
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
+import at.hannibal2.skyhanni.events.ItemAddEvent
import at.hannibal2.skyhanni.events.mining.FossilExcavationEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
@@ -155,6 +157,20 @@ object ExcavatorProfitTracker {
}
@SubscribeEvent
+ fun onItemAdd(event: ItemAddEvent) {
+ if (!isEnabled()) return
+
+ val internalName = event.internalName
+ if (event.source == ItemAddManager.Source.COMMAND) {
+ tryAddItem(internalName, event.amount, command = true)
+ }
+ }
+
+ private fun tryAddItem(internalName: NEUInternalName, amount: Int, command: Boolean) {
+ tracker.addItem(internalName, amount, command)
+ }
+
+ @SubscribeEvent
fun onFossilExcavation(event: FossilExcavationEvent) {
if (!isEnabled()) return
for ((name, amount) in event.loot) {
@@ -185,11 +201,11 @@ object ExcavatorProfitTracker {
val internalName = NEUInternalName.fromItemNameOrNull(name)
if (internalName == null) {
- ChatUtils.debug("no price for exavator profit: '$name'")
+ ChatUtils.debug("no price for excavator profit: '$name'")
return
}
// TODO use primitive item stacks in trackers
- tracker.addItem(internalName, amount)
+ tryAddItem(internalName, amount, command = false)
}
@SubscribeEvent