Fixed endless loop when ItemUpdateEvent is cancelled

This commit is contained in:
NichtStudioCode 2021-05-11 18:52:25 +02:00
parent 8e0ca7ea44
commit 640cdef177

@ -362,9 +362,8 @@ public class VirtualInventory implements ConfigurationSerializable {
}
// find all empty slots and put the item there
while (amountLeft > 0) {
int emptySlot = ArrayUtils.findFirstEmptyIndex(items);
if (emptySlot == -1) break;
for (int emptySlot : ArrayUtils.findEmptyIndices(items)) {
if (amountLeft == 0) break;
amountLeft = addToEmpty(updateReason, emptySlot, itemStack, amountLeft);
}