From 8e685fd9f76055b1f0d63341a3071620b3674ec3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 15 Apr 2023 20:08:04 +0200 Subject: used more getInternalNameOrNull --- .../features/garden/visitor/GardenVisitorFeatures.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 8ea7b4f03..134f2e4b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -166,10 +166,10 @@ class GardenVisitorFeatures { list.add("§7(§fAny§7)") } else { for (item in items) { - try { - val internalName = NEUItems.getInternalName(item) + val internalName = NEUItems.getInternalNameOrNull(item) + if (internalName != null) { list.add(NEUItems.getItemStack(internalName)) - } catch (e: Exception) { + } else { list.add(" '$item' ") } } @@ -275,14 +275,11 @@ class GardenVisitorFeatures { if (i > 1 && !endReached) { val (itemName, amount) = ItemUtils.readItemAmount(line) if (itemName != null) { - var internalName: String - try { - internalName = NEUItems.getInternalName(itemName) - } catch (e: NullPointerException) { + val internalName = NEUItems.getInternalNameOrNull(itemName) + if (internalName == null) { val message = "internal name is null: '$itemName'" println(message) LorenzUtils.error(message) - e.printStackTrace() return } val price = NEUItems.getPrice(internalName) * amount -- cgit