aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
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
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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt32
3 files changed, 31 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index abeccc2f1..d86c47891 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -292,7 +292,7 @@ class SkyHanniMod {
loadModule(ShowFishingItemName())
loadModule(WarpTabComplete)
loadModule(PlayerTabComplete)
- loadModule(SlayerItemProfitTracker())
+ loadModule(SlayerItemProfitTracker)
loadModule(SlayerItemsOnGround())
loadModule(DetectBrokenHyperion())
loadModule(RestorePieceOfWizardPortalLore())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index aacbfc5c1..054657602 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -22,6 +22,7 @@ import at.hannibal2.skyhanni.features.misc.CityProjectFeatures
import at.hannibal2.skyhanni.features.misc.CollectionCounter
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager
+import at.hannibal2.skyhanni.features.slayer.SlayerItemProfitTracker
import at.hannibal2.skyhanni.test.PacketTest
import at.hannibal2.skyhanni.test.SkyHanniTestCommand
import at.hannibal2.skyhanni.test.TestBingo
@@ -63,6 +64,7 @@ object Commands {
registerCommand("shrpcstart") { DiscordRPCManager.startCommand() }
registerCommand("shcropstartlocation") { GardenStartLocation.setLocationCommand() }
registerCommand("shstopcityprojectreminder") { CityProjectFeatures.disable() }
+ registerCommand("shclearslayerprofits") { SlayerItemProfitTracker.clearProfitCommand(it) }
// for users - fix bugs
registerCommand("shupdaterepo") { SkyHanniMod.repo.updateRepo() }
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"
+ )
+ }
}