Sort Minecraft Crate Items SPIGOT?

pr
6

I want the items in the box to be stacked automatically.
I'm there for a few hours and don't know how I could do it anymore.

Here what I have currently written:

ItemStack stack = null;
int itemPos = 0;
for (int c = 0; c if (chestData.getSnapshotInventory (). GetItem (c)! = null) {
if (stack == null) {
if (chestData.getSnapshotInventory (). GetItem (c) .getAmount ()! = chestData.getSnapshotInventory (). GetItem (c) .getMaxStackSize ()) {
stack = chestData.getSnapshotInventory (). GetItem (c);
stack.setAmount (chestData.getSnapshotInventory (). GetItem (c) .getAmount ());
itemPos = c;
}
} else if (stack.equals (chestData.getSnapshotInventory (). GetItem (c {
if (stack.getAmount () + chestData.getSnapshotInventory (). GetItem (c) .getAmount ()> = stack.getMaxStackSize ()) {
int distance = stack.getMaxStackSize () - stack.getAmount ();
chestData.getSnapshotInventory (). SetItem (itemPos, stack);
stack.setAmount (stack.getMaxStackSize ());
chestData.getSnapshotInventory (). GetItem (c) .setAmount (chestData.getSnapshotInventory (). GetItem (c) .getAmount () - distance);
} else {
stack.setAmount (stack.getAmount () + chestData.getSnapshotInventory (). GetItem (c) .getAmount ());
chestData.getSnapshotInventory (). GetItem (itemPos) .setAmount (stack.getAmount ());
}
}

}
}

is

Maybe this will help you:

https://hub.spigotmc.org/...Stack.html

(XD or otherwise simply: Shift> * Item-Click * or * Item-Double-Click *, but hopefully that already knows Haha)

pr

Thank you, but that doesn't really help me. I want to stack the items via a plugin, so if there are 2x 32Items just stack 64 at once, thanks anyway.

is

Ah ok

is

So an Auto Stack PLUGIN?

is
pr

No either, only potions are stacked here, but I want everything to be stacked.