diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt | 22 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 7 |
2 files changed, 21 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt index fda108391..b3eb82c95 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -93,7 +93,16 @@ class GardenVisitorFeatures { if (requiredItems.isNotEmpty()) { newDisplay.add(Collections.singletonList("§7Visitor items needed:")) for ((name, amount) in requiredItems) { - val internalName = NEUItems.getInternalName(name) + val internalName: String + try { + internalName = NEUItems.getInternalName(name) + } catch (e: NullPointerException) { + val message = "internal name is null: '$name'" + println(message) + LorenzUtils.error(message) + e.printStackTrace() + continue + } val itemStack = NEUItems.getItemStack(internalName) newDisplay.add(listOf(" §7- ", itemStack, "$name §8x$amount")) } @@ -140,7 +149,16 @@ class GardenVisitorFeatures { if (i > 1) { val (itemName, amount) = ItemUtils.readItemAmount(line) if (itemName != null) { - val lowestBin = NEUItems.getPrice(NEUItems.getInternalName(itemName)) + val lowestBin: Double + try { + lowestBin = NEUItems.getPrice(NEUItems.getInternalName(itemName)) + } catch (e: NullPointerException) { + val message = "internal name is null: '$itemName'" + println(message) + LorenzUtils.error(message) + e.printStackTrace() + continue + } val price = lowestBin * amount totalPrice += price val format = NumberUtil.format(price) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 13366c969..5f8f035f4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -20,12 +20,7 @@ object NEUItems { if (itemNameCache.containsKey(itemName)) { return itemNameCache[itemName]!! } - // We love hypixel naming moments - // TODO remove workaround - val name = if (itemName.contains("Jack o' Lantern")) { - itemName.replace("Jack o' Lantern", "Jack o'Lantern") - } else itemName - val internalName = ItemResolutionQuery.findInternalNameByDisplayName(name, false) + val internalName = ItemResolutionQuery.findInternalNameByDisplayName(itemName, false) itemNameCache[itemName] = internalName return internalName } |