From b5dcedb64567c85b9d4eaa5317ca28703c631154 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 26 May 2020 14:17:52 +0200 Subject: [PATCH] Hotfix inventory size failure Signed-off-by: Lixfel --- .../fightsystem/listener/InFightInventoryListener.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/InFightInventoryListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/InFightInventoryListener.java index 8cef341..65c1bb0 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/InFightInventoryListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/InFightInventoryListener.java @@ -67,12 +67,11 @@ public class InFightInventoryListener extends BasicListener { @EventHandler public void onBlockBreak(BlockBreakEvent event) { Inventory inventory = event.getPlayer().getInventory(); - int inventorySize = inventory.getSize(); Material type = event.getBlock().getType(); 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); if (itemStack != null && itemStack.getType().equals(type) && itemStack.getAmount() != itemStack.getMaxStackSize()) { 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); if (itemStack == null || itemStack.getType().equals(Material.AIR)) { itemStack = new ItemStack(type, 1);