diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java | 26 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt | 12 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java index b17f31279..0f6f0be2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java @@ -4,10 +4,15 @@ import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class NextJacobContestConfig { @Expose @ConfigOption(name = "Show Jacob's Contest", desc = "Show the current or next Jacob's farming contest time and crops.") @@ -55,5 +60,26 @@ public class NextJacobContestConfig { public boolean warnPopup = false; @Expose + @ConfigOption( + name = "Warn For", + desc = "Only Warn for these crops" + ) + @ConfigEditorDraggableList( + exampleText = { + "Wheat", + "Carrot", + "Potato", + "Nether Wart", + "Pumpkin", + "Melon", + "Cocoa Beans", + "Sugar Cane", + "Cactus", + "Mushroom" + } + ) + public List<Integer> warnFor = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); + + @Expose public Position pos = new Position(-200, 10, false, true); } 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 2baa27ffa..e6f59fe88 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -361,6 +361,7 @@ object GardenNextJacobContest { private fun warn(duration: Duration, crops: List<CropType>, boostedCrop: CropType?) { if (!config.warn) return if (config.warnTime.seconds <= duration) return + if (!warnForCrop()) return if (System.currentTimeMillis() < lastWarningTime) return lastWarningTime = System.currentTimeMillis() + 60_000 * 40 @@ -370,8 +371,8 @@ object GardenNextJacobContest { LorenzUtils.sendTitle("§eFarming Contest!", 5.seconds) SoundUtils.playBeepSound() - val cropTextNoColor = - crops.joinToString(", ") { if (it == boostedCrop) "<b>${it.cropName}</b>" else it.cropName } + val cropTextNoColor = crops.joinToString(", ") { + if (it == boostedCrop) "<b>${it.cropName}</b>" else it.cropName } if (config.warnPopup && !Display.isActive()) { SkyHanniMod.coroutineScope.launch { openPopupWindow( @@ -420,6 +421,13 @@ object GardenNextJacobContest { ) } + private fun warnForCrop(): Boolean { + for(crop in nextContestCrops) { + if (config.warnFor.contains(crop.ordinal)) return true + } + return false + } + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return |