Fixed endless loop when ItemUpdateEvent is cancelled
This commit is contained in:
parent
8e0ca7ea44
commit
640cdef177
@ -362,9 +362,8 @@ public class VirtualInventory implements ConfigurationSerializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find all empty slots and put the item there
|
// find all empty slots and put the item there
|
||||||
while (amountLeft > 0) {
|
for (int emptySlot : ArrayUtils.findEmptyIndices(items)) {
|
||||||
int emptySlot = ArrayUtils.findFirstEmptyIndex(items);
|
if (amountLeft == 0) break;
|
||||||
if (emptySlot == -1) break;
|
|
||||||
amountLeft = addToEmpty(updateReason, emptySlot, itemStack, amountLeft);
|
amountLeft = addToEmpty(updateReason, emptySlot, itemStack, amountLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user