diff options
Diffstat (limited to 'src')
3 files changed, 5 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt index 538087fac..9e18fced9 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt @@ -3,4 +3,6 @@ package at.hannibal2.skyhanni.events import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack -class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList<String>) : LorenzEvent()
\ No newline at end of file +class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList<String>) : LorenzEvent() { + fun toolTipRemovedPrefix() = toolTip.map { it.removePrefix("§5§o") } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index 75e62468f..e57789884 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -34,18 +33,8 @@ class GardenComposterInventoryFeatures { var indexFullCost = 0 var fullPrice = 0.0 var amountItems = 0 - for (originalLine in list) { + for (line in event.toolTipRemovedPrefix()) { i++ - val line = try { - originalLine.substring(4) - } catch (e: Throwable) { - ErrorManager.logErrorWithData( - e, "Error reading composter data.", - "originalLine" to originalLine, - "list" to list, - ) - return - } if (line == "§7Upgrade Cost:") { next = true indexFullCost = i diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt index 9a4deaf2f..037031360 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt @@ -25,9 +25,8 @@ class GardenNextPlotPrice { var next = false val list = event.toolTip var i = -1 - for (l in list) { + for (line in event.toolTipRemovedPrefix()) { i++ - val line = l.substring(4) if (line.contains("Cost")) { next = true continue |