aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorthesefer <20844000+thesefer@users.noreply.github.com>2023-04-26 21:58:21 +0200
committerGitHub <noreply@github.com>2023-04-26 21:58:21 +0200
commitb7b1f37f93e1df412b3a4603c184a1856a72b8f9 (patch)
tree13a12a425f03256eb82dcf4f93682ff37a01c143 /src/main/java
parenta575ac91e1efb6f398e5bfd43fd2428c3251f928 (diff)
downloadskyhanni-b7b1f37f93e1df412b3a4603c184a1856a72b8f9.tar.gz
skyhanni-b7b1f37f93e1df412b3a4603c184a1856a72b8f9.tar.bz2
skyhanni-b7b1f37f93e1df412b3a4603c184a1856a72b8f9.zip
Option to stay within the display limit for Crop Time/Money (#59)
Co-authored-by: Roman / Linnea Gräf <roman.graef@gmail.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt7
5 files changed, 20 insertions, 5 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 3f89d4def..0dcd42809 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -275,6 +275,12 @@ public class Garden {
@ConfigAccordionId(id = 7)
public int cropMilestoneShowOnlyBest = 10;
+ @Expose
+ @ConfigOption(name = "Extend top list", desc = "Add current crop to the list if its lower ranked than the set limit by extending the list.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean cropMilestoneShowCurrent = true;
+
// TODO moulconfig runnable support
@Expose
@ConfigOption(
@@ -625,6 +631,12 @@ public class Garden {
@ConfigAccordionId(id = 13)
public int moneyPerHourShowOnlyBest = 5;
+ @Expose
+ @ConfigOption(name = "Extend top list", desc = "Add current crop to the list if its lower ranked than the set limit by extending the list.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 13)
+ public boolean moneyPerHourShowCurrent = true;
+
// TODO moulconfig runnable support
@Expose
@ConfigOption(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
index 7a35c8ab4..485ba6435 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt
@@ -128,7 +128,7 @@ class CropMoneyDisplay {
number++
val cropName = cropNames[internalName]!!
val isCurrent = cropName == GardenAPI.cropInHand
- if (number > config.moneyPerHourShowOnlyBest && !isCurrent) continue
+ if (number > config.moneyPerHourShowOnlyBest && (!config.moneyPerHourShowCurrent || !isCurrent)) continue
val list = mutableListOf<Any>()
if (!config.moneyPerHourCompact) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
index 29e7411e5..0b9993826 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt
@@ -92,7 +92,7 @@ class GardenBestCropTime {
val duration = TimeUtils.formatDuration(millis, maxUnits = 2)
val isCurrent = crop == currentCrop
number++
- if (number > config.cropMilestoneShowOnlyBest && !isCurrent) continue
+ if (number > config.cropMilestoneShowOnlyBest && (!config.cropMilestoneShowCurrent || !isCurrent)) continue
val list = mutableListOf<Any>()
if (!config.cropMilestoneBestCompact) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
index 6e7cd2014..7a712cc0d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
@@ -293,7 +293,7 @@ class GardenCropMilestoneDisplay {
val format = LorenzUtils.formatInteger(farmingFortuneSpeed * 60)
lineMap[4] = Collections.singletonList("§7Crops/Minute§8: §e$format")
- val formatBps = LorenzUtils.formatDouble(averageBlocksPerSecond)
+ val formatBps = LorenzUtils.formatDouble(averageBlocksPerSecond, 2)
lineMap[5] = Collections.singletonList("§7Blocks/Second§8: §e$formatBps")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 8047cc61a..7d0f817b5 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -134,8 +134,11 @@ object LorenzUtils {
fun formatInteger(l: Long): String = NumberFormat.getIntegerInstance().format(l)
- fun formatDouble(d: Double, round: Int = 1): String =
- NumberFormat.getNumberInstance().format(d.round(round))
+ fun formatDouble(d: Double, round: Int = 1): String {
+ val numberInstance = NumberFormat.getNumberInstance()
+ numberInstance.maximumFractionDigits = round
+ return numberInstance.format(d.round(round))
+ }
fun consoleLog(text: String) {
SkyHanniMod.consoleLog(text)