diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt | 45 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt | 4 |
2 files changed, 45 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 2ad7d11fd..6fce2122d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.garden.NextJacobContestConfig.ShareContestsEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -21,7 +22,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderSingleLineWithItems import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark -import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.now import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -44,6 +44,7 @@ import javax.swing.JOptionPane import javax.swing.UIManager import kotlin.time.Duration import kotlin.time.Duration.Companion.days +import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds @@ -83,6 +84,45 @@ object GardenNextJacobContest { private var isSendingContests = false @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Garden Next Jacob Contest") + + if (!GardenAPI.inGarden()) { + event.addIrrelevant("not in garden") + return + } + + event.addData { + add("Current time: ${SimpleTimeMark.now()}") + add("") + + val display = display.filterIsInstance<String>().joinToString("") + add("Display: '$display'") + add("") + + add("Contests:") + for (contest in contests) { + val time = contest.key + val passedSince = time.passedSince() + val timeUntil = time.timeUntil() + val farmingContest = contest.value + val crops = farmingContest.crops + val recently = 0.seconds..2.hours + if (passedSince in recently || timeUntil in recently) { + add(" Time: $time") + if (passedSince.isPositive()) { + add(" Passed since: $passedSince") + } + if (timeUntil.isPositive()) { + add(" Time until: $timeUntil") + } + add(" Crops: $crops") + } + } + } + } + + @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { var next = false val newList = mutableListOf<String>() @@ -385,7 +425,7 @@ object GardenNextJacobContest { // Check that it only gets called once for the current event if (lastWarningTime.passedSince() < config.warnTime.seconds) return - lastWarningTime = now() + lastWarningTime = SimpleTimeMark.now() val cropText = crops.joinToString("§7, ") { (if (it == boostedCrop) "§6" else "§a") + it.cropName } ChatUtils.chat("Next farming contest: $cropText") LorenzUtils.sendTitle("§eFarming Contest!", 5.seconds) @@ -594,3 +634,4 @@ object GardenNextJacobContest { } } } + diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt index 42f5a5c96..3ffe8f8e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt @@ -22,9 +22,9 @@ object DebugCommand { list.add("= Debug Information for SkyHanni ${SkyHanniMod.version} =") list.add("") - val search = args.getOrNull(0) + val search = args.joinToString(" ") list.add( - if (search != null) { + if (search.isNotEmpty()) { if (search.equalsIgnoreColor("all")) { "search for everything:" } else "search '$search':" |