Skip to content

Commit

Permalink
remove unneeded if
Browse files Browse the repository at this point in the history
  • Loading branch information
catgirlseraid committed Jul 24, 2024
1 parent d28bef4 commit 98b157c
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 98b157c

Please sign in to comment.