aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/slayer
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-16 01:20:26 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-16 01:20:26 +0200
commit82531dc49116a76052b44cc4f42c8e0be46afd58 (patch)
tree83d11ab7907d52a64a51bf81a98b3a7a5a92ce6b /src/main/java/at/hannibal2/skyhanni/features/slayer
parentc9f7e3f68848b06e097da7df7d1b7332417f4688 (diff)
downloadskyhanni-82531dc49116a76052b44cc4f42c8e0be46afd58.tar.gz
skyhanni-82531dc49116a76052b44cc4f42c8e0be46afd58.tar.bz2
skyhanni-82531dc49116a76052b44cc4f42c8e0be46afd58.zip
Added command /shclearslayerprofits
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
index 1dd765447..1bed3270e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
@@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.concurrent.TimeUnit
-class SlayerItemProfitTracker {
+object SlayerItemProfitTracker {
private val config get() = SkyHanniMod.feature.slayer.itemProfitTracker
private var collectedCache = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.SECONDS).build<Int, Unit>()
@@ -271,15 +271,15 @@ class SlayerItemProfitTracker {
"§cReset session!",
listOf("§cThis will reset your", "§ccurrent session for", "§c$itemLogCategory"),
) {
- resetCurrentSession()
+ resetData(DisplayMode.CURRENT)
update()
})
}
}
- private fun resetCurrentSession() {
+ private fun resetData(displayMode: DisplayMode) {
val currentLog = currentLog() ?: return
- val list = currentLog.get(DisplayMode.CURRENT)
+ val list = currentLog.get(displayMode)
list.items.clear()
list.mobKillCoins = 0
list.slayerSpawnCost = 0
@@ -338,4 +338,28 @@ class SlayerItemProfitTracker {
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+
+ fun clearProfitCommand(args: Array<String>) {
+ if (itemLogCategory == "") {
+ LorenzUtils.chat(
+ "§c[SkyHanni] No current slayer data found. " +
+ "Go to a slayer area and start the specific slayer type you want to reset the data of."
+ )
+ return
+ }
+
+ if (args.size == 1) {
+ if (args[0].lowercase() == "confirm") {
+ resetData(DisplayMode.TOTAL)
+ update()
+ LorenzUtils.chat("§e[SkyHanni] You reset your $itemLogCategory slayer data!")
+ return
+ }
+ }
+
+ LorenzUtils.clickableChat(
+ "§e[SkyHanni] Are you sure you want to reset all your $itemLogCategory slayer data? Click here to confirm.",
+ "shclearslayerprofits confirm"
+ )
+ }
}