Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,22 @@ public VaultResult updateExistingVaultItem(Vault currentVault, UUID uniqueId, It

@Override
public VaultResult addNewItemToVault(Vault vault, UUID uniqueId, ItemStack currentItem, int quantity, int size, int totalSlots, int slot) {
int nextSlot = vault.getNextSlot() + ((vault.getVaultId() - 1) * size);
if (nextSlot == -1 || nextSlot >= totalSlots) {
int nextSlot = vault.getNextSlot();
if (nextSlot == -1) {
return null;
}

if (slot == -1) slot = vault.getNextSlot();
int virtualNextSlot = nextSlot + ((vault.getVaultId() - 1) * size);
if (virtualNextSlot >= totalSlots) {
return null;
}

if (slot == -1) {
slot = nextSlot;
if (slot == -1) {
return null;
}
}

VaultItem newVaultItem = new ZVaultItem(slot, currentItem, quantity);
vault.getVaultItems().put(slot, newVaultItem);
Expand Down