PrepareItemCraftEvent duplicate item

In PrepareItemCraftEvent there is bug, namely it's about duplicate items. When the object is created, the number of items temporarily jumps to 8 or 16 or 64.

My code:

if(e.getInventory().getResult() !=null) {

if(e.getInventory().getResult().getType().equals(its.getType())) {

if(e.getInventory().getItem(1) != null) {

if(e.getInventory().getItem(1).getAmount() >= a

&& e.getInventory().getItem(2).getAmount() >= b

&& e.getInventory().getItem(3).getAmount() >= c

&& e.getInventory().getItem(4).getAmount() >= d

&& e.getInventory().getItem(5).getAmount() >= ee

&& e.getInventory().getItem(6).getAmount() >= f

&& e.getInventory().getItem(7).getAmount() >= g

&& e.getInventory().getItem(8).getAmount() >= h

&& e.getInventory().getItem(9).getAmount() >= i) {

return;

}

else {

e.getInventory().setResult(new ItemStack(Material.AIR, 1));

}

}

}

}...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts