aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 16:21:41 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 16:21:41 +0100
commitd56e3075c7d418e0004f072703e635e83e2a06cf (patch)
treef695e11d12de721964766b98640ced72a1430e82 /src
parentf277a99f2c547c446b8c5e0ddfa3021062e3cf40 (diff)
downloadskyhanni-d56e3075c7d418e0004f072703e635e83e2a06cf.tar.gz
skyhanni-d56e3075c7d418e0004f072703e635e83e2a06cf.tar.bz2
skyhanni-d56e3075c7d418e0004f072703e635e83e2a06cf.zip
code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/NextJacobContestConfig.java21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt7
3 files changed, 7 insertions, 23 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 0f6f0be2f..2da4b7c42 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
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.features.garden;
import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
+import at.hannibal2.skyhanni.features.garden.CropType;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList;
@@ -10,7 +11,6 @@ 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 {
@@ -62,23 +62,10 @@ public class NextJacobContestConfig {
@Expose
@ConfigOption(
name = "Warn For",
- desc = "Only Warn for these crops"
+ 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));
+ @ConfigEditorDraggableList
+ public List<CropType> warnFor = new ArrayList<>(CropType.getEntries());
@Expose
public Position pos = new Position(-200, 10, false, true);
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
index 41ef944ea..05abfe744 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
@@ -40,6 +40,8 @@ enum class CropType(
val multiplier by lazy { if (this == SUGAR_CANE || this == CACTUS) 2 else 1 }
+ override fun toString(): String = cropName
+
companion object {
fun getByNameOrNull(itemName: String): CropType? {
if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM
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 e6f59fe88..d5d1881e2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -421,12 +421,7 @@ object GardenNextJacobContest {
)
}
- private fun warnForCrop(): Boolean {
- for(crop in nextContestCrops) {
- if (config.warnFor.contains(crop.ordinal)) return true
- }
- return false
- }
+ private fun warnForCrop(): Boolean = nextContestCrops.any { it in config.warnFor }
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {