aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt7
3 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index e48d0eee7..74b874186 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -258,6 +258,14 @@ public class Garden {
public boolean cropMilestoneBestAlwaysOn = false;
@Expose
+ @ConfigOption(
+ name = "Compact Display",
+ desc = "Make the best crop time more compact by removing the crop name and exp and making the time format shorter")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean cropMilestoneBestCompact = false;
+
+ @Expose
public Position cropMilestoneNextDisplayPos = new Position(-112, -143, false, true);
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
index 139573899..003bcde11 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenBestCropTime.kt
@@ -34,7 +34,11 @@ class GardenBestCropTime {
}
val title = if (gardenExp) "§2Garden Experience" else "§bSkyBlock Level"
- newList.addAsSingletonList("§eBest Crop Time §7($title§7)")
+ if (config.cropMilestoneBestCompact) {
+ newList.addAsSingletonList("§eBest Crop Time")
+ } else {
+ newList.addAsSingletonList("§eBest Crop Time §7($title§7)")
+ }
if (sorted.isEmpty()) {
newList.addAsSingletonList("§cFarm crops to add them to this list!")
@@ -44,7 +48,8 @@ class GardenBestCropTime {
var number = 0
for (crop in sorted.keys) {
val millis = timeTillNextCrop[crop]!!
- val duration = TimeUtils.formatDuration(millis)
+ val maxUnits = if (config.cropMilestoneBestCompact) 2 else -1
+ val duration = TimeUtils.formatDuration(millis, maxUnits = maxUnits)
val isCurrent = crop == currentCrop
number++
if (number > config.cropMilestoneShowOnlyBest && !isCurrent) continue
@@ -56,10 +61,12 @@ class GardenBestCropTime {
val color = if (isCurrent) "§e" else "§7"
val contestFormat = if (GardenNextJacobContest.isNextCrop(crop)) "§n" else ""
val nextTier = GardenCropMilestones.getTierForCrops(crop.getCounter()) + 1
- val cropNameDisplay = "$color$contestFormat${crop.cropName} $nextTier§r"
+
+ val cropName = if (!config.cropMilestoneBestCompact) crop.cropName +" " else ""
+ val cropNameDisplay = "$color$contestFormat$cropName$nextTier§r"
list.add("$cropNameDisplay §b$duration")
- if (gardenExp) {
+ if (gardenExp && !config.cropMilestoneBestCompact) {
val gardenExpForTier = getGardenExpForTier(nextTier)
list.add(" §7(§2$gardenExpForTier §7Exp)")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 0e4561041..1491662c1 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -12,6 +12,7 @@ object TimeUtils {
biggestUnit: TimeUnit = TimeUnit.YEAR,
showMilliSeconds: Boolean = false,
longName: Boolean = false,
+ maxUnits: Int = -1
): String {
var milliseconds = millis + 999
val map = mutableMapOf<TimeUnit, Int>()
@@ -24,6 +25,7 @@ object TimeUtils {
}
val builder = StringBuilder()
+ var count = 0
for ((unit, value) in map.entries) {
if (value > 0 || builder.isNotEmpty() || unit == TimeUnit.SECOND) {
builder.append(value)
@@ -43,6 +45,11 @@ object TimeUtils {
} else {
builder.append("$name ")
}
+
+ count++
+ if (maxUnits != -1) {
+ if (count == maxUnits) break
+ }
}
}
return builder.toString()