Fixed bug that could cause bank to throw index out of bounds and vanish items when rearranging tabs with completely full bank

This commit is contained in:
Ceikry 2022-07-03 07:23:47 +00:00 committed by Ryan
parent 2846ff7172
commit f94fb24608

View file

@ -39,6 +39,14 @@ public class SlotSwitchPacket implements IncomingPacket {
int tabIndex = BankContainer.getArrayIndex(withChildId);
if (tabIndex > -1) {
secondSlot = tabIndex == 10 ? player.getBank().freeSlot() : player.getBank().getTabStartSlot()[tabIndex] + player.getBank().getItemsInTab(tabIndex);
Item inSlot = player.getBank().get(slot);
if (secondSlot == -1 && player.getBank().remove(inSlot)) {
player.getBank().add(inSlot);
return;
}
childId = player.getBank().getTabByItemSlot(slot);
if (secondSlot > slot) {
player.getBank().insert(slot, secondSlot - 1);