aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 12:46:34 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-27 12:46:34 +0100
commitb2536ac320cdb8de06c91ce04326ab004901ef1b (patch)
tree134b710a301538511f934ad7e96710ab90a0b93c /src/main
parent67dca480e1a167f2462a28ae38939bbc2cb21ddb (diff)
downloadskyhanni-b2536ac320cdb8de06c91ce04326ab004901ef1b.tar.gz
skyhanni-b2536ac320cdb8de06c91ce04326ab004901ef1b.tar.bz2
skyhanni-b2536ac320cdb8de06c91ce04326ab004901ef1b.zip
Fixed crash bc of changed NEU Repo name for Jack o' Lantern (Thx jani)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt7
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
}