From 98b157c98c8227eb6ca69a628e5d8697484b651a Mon Sep 17 00:00:00 2001 From: catgirlseraid <77941535+catgirlseraid@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:04:28 +1200 Subject: [PATCH] remove unneeded if --- .../features/inventory/ItemPickupLog.kt | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt index 4da5ad1d65c0..e67b7fa3b8d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt @@ -290,22 +290,19 @@ object ItemPickupLog { val item = iterator.next() if (removedItems.containsKey(item.key)) { - val it = removedItems[item.key] - if (it != null) { - val currentTotalValue = item.value.amount - it.amount - val entry = PickupEntry(item.value.name, currentTotalValue, item.value.neuInternalName) - - if (currentTotalValue > 0) { - display.add(renderList("§a+", entry)) - } else if (currentTotalValue < 0) { - display.add(renderList("§c", entry)) - } else { - itemsAddedToInventory.remove(item.key) - itemsRemovedFromInventory.remove(item.key) - } - removedItems.remove(item.key) - iterator.remove() + val currentTotalValue = item.value.amount - (removedItems[item.key]?.amount ?: 0) + val entry = PickupEntry(item.value.name, currentTotalValue, item.value.neuInternalName) + + if (currentTotalValue > 0) { + display.add(renderList("§a+", entry)) + } else if (currentTotalValue < 0) { + display.add(renderList("§c", entry)) + } else { + itemsAddedToInventory.remove(item.key) + itemsRemovedFromInventory.remove(item.key) } + removedItems.remove(item.key) + iterator.remove() } else { display.add(renderList("§a+", item.value)) }