diff options
Diffstat (limited to 'src/main/java/at')
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" + ) + } } |