aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt7
2 files changed, 12 insertions, 11 deletions
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 53de2fa9a..c00e2c6e0 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
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed
import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.isSpeedDataEmpty
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
@@ -133,16 +134,11 @@ object CropMoneyDisplay {
}
if (InventoryUtils.itemInHandId.contains("DICER") && config.moneyPerHourDicer) {
- var dicerDrops = 0.0
- val internalName: NEUInternalName
- if (it == CropType.MELON) {
- dicerDrops = GardenCropSpeed.latestMelonDicer
- internalName = "ENCHANTED_MELON".asInternalName()
- } else if (it == CropType.PUMPKIN) {
- dicerDrops = GardenCropSpeed.latestPumpkinDicer
- internalName = "ENCHANTED_PUMPKIN".asInternalName()
- } else {
- error("Impossible")
+ val (dicerDrops, internalName) = when (it) {
+ CropType.MELON -> GardenCropSpeed.latestMelonDicer to "ENCHANTED_MELON".asInternalName()
+ CropType.PUMPKIN -> GardenCropSpeed.latestPumpkinDicer to "ENCHANTED_PUMPKIN".asInternalName()
+
+ else -> CopyErrorCommand.skyHanniError("Unknown dicer: $it")
}
val bazaarData = internalName.getBazaarData()
val price =
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 69288a896..946255996 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -16,10 +16,15 @@ object CopyErrorCommand {
private var cache =
CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).build<Pair<String, Int>, Unit>()
+ fun skyHanniError(message: String): Nothing {
+ val exception = IllegalStateException(message)
+ logError(exception, message)
+ throw exception
+ }
+
fun command(array: Array<String>) {
if (array.size != 1) {
LorenzUtils.chat("§cUse /shcopyerror <error id>")
-
return
}