SteamWar/FightSystem
Archiviert
13
1

Hotfix inventory size failure

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-05-26 14:17:52 +02:00
Ursprung 858e1b52ca
Commit b5dcedb645

Datei anzeigen

@ -67,12 +67,11 @@ public class InFightInventoryListener extends BasicListener {
@EventHandler @EventHandler
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
Inventory inventory = event.getPlayer().getInventory(); Inventory inventory = event.getPlayer().getInventory();
int inventorySize = inventory.getSize();
Material type = event.getBlock().getType(); Material type = event.getBlock().getType();
ItemStack itemStack; ItemStack itemStack;
for (int i = 0; i < inventorySize; i++) { for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
itemStack = inventory.getItem(i); itemStack = inventory.getItem(i);
if (itemStack != null && itemStack.getType().equals(type) && itemStack.getAmount() != itemStack.getMaxStackSize()) { if (itemStack != null && itemStack.getType().equals(type) && itemStack.getAmount() != itemStack.getMaxStackSize()) {
itemStack.setType(type); itemStack.setType(type);
@ -83,7 +82,7 @@ public class InFightInventoryListener extends BasicListener {
} }
} }
for (int i = 0; i < inventorySize; i++) { for (int i = 0; i <= 35; i++) { //35 is the last normal inventory slot
itemStack = inventory.getItem(i); itemStack = inventory.getItem(i);
if (itemStack == null || itemStack.getType().equals(Material.AIR)) { if (itemStack == null || itemStack.getType().equals(Material.AIR)) {
itemStack = new ItemStack(type, 1); itemStack = new ItemStack(type, 1);