aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorObsidian <108832807+Obsidianninja11@users.noreply.github.com>2023-12-08 06:19:38 -0900
committerGitHub <noreply@github.com>2023-12-08 16:19:38 +0100
commitf277a99f2c547c446b8c5e0ddfa3021062e3cf40 (patch)
treec9ba3748ff10286ebaf326498009a7d6be648140 /src/main/java/at/hannibal2/skyhanni
parent735c6edad7032046640c261d267142f7d493445f (diff)
downloadskyhanni-f277a99f2c547c446b8c5e0ddfa3021062e3cf40.tar.gz
skyhanni-f277a99f2c547c446b8c5e0ddfa3021062e3cf40.tar.bz2
skyhanni-f277a99f2c547c446b8c5e0ddfa3021062e3cf40.zip
Feature: Only warn for certain crops for Jacobs contest (#656)
Added option to only Warn for specific crop contests. #656
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt12
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