aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 20:08:04 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 20:08:04 +0200
commit8e685fd9f76055b1f0d63341a3071620b3674ec3 (patch)
tree3c99a21e70cbd1b2e78bfe81f03b449596e94d5e /src/main
parent751def453a076baa1d2a07dc03f6fddcdf142271 (diff)
downloadskyhanni-8e685fd9f76055b1f0d63341a3071620b3674ec3.tar.gz
skyhanni-8e685fd9f76055b1f0d63341a3071620b3674ec3.tar.bz2
skyhanni-8e685fd9f76055b1f0d63341a3071620b3674ec3.zip
used more getInternalNameOrNull
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt13
1 files changed, 5 insertions, 8 deletions
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