diff --git a/src/me/mrCookieSlime/Slimefun/Android/ProgrammableAndroid.java b/src/me/mrCookieSlime/Slimefun/Android/ProgrammableAndroid.java index 8ba0f054e..ea6af4535 100644 --- a/src/me/mrCookieSlime/Slimefun/Android/ProgrammableAndroid.java +++ b/src/me/mrCookieSlime/Slimefun/Android/ProgrammableAndroid.java @@ -211,9 +211,18 @@ public abstract class ProgrammableAndroid extends SlimefunItem { boolean allow = reason.equals(UnregisterReason.PLAYER_BREAK) && (BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass")); if (allow) { - if (BlockStorage.getInventory(b).getItemInSlot(43) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(43)); - for (int slot: getOutputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + if (inv.getItemInSlot(43) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(43)); + inv.replaceExistingItem(43, null); + } + for (int slot: getOutputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } AndroidStatusHologram.remove(b); } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java index 76475f53a..d1aec7710 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AContainer.java @@ -84,10 +84,16 @@ public abstract class AContainer extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getInputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } progress.remove(b); @@ -134,11 +140,20 @@ public abstract class AContainer extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); - } - for (int slot: getOutputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } + for (int slot: getOutputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } processing.remove(b); progress.remove(b); diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AFarm.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AFarm.java index c49da80ef..d480afa0a 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AFarm.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AFarm.java @@ -68,8 +68,14 @@ public abstract class AFarm extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getOutputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getOutputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } @@ -111,8 +117,14 @@ public abstract class AFarm extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getOutputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getOutputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java index 3d0341982..19f7a8c29 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java @@ -88,10 +88,16 @@ public abstract class AGenerator extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getInputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } progress.remove(b.getLocation()); @@ -141,10 +147,16 @@ public abstract class AGenerator extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getInputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } progress.remove(b.getLocation()); diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AReactor.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AReactor.java index da03cac9f..1d02c7d88 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AReactor.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AReactor.java @@ -134,13 +134,22 @@ public abstract class AReactor extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getFuelSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getCoolantSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } progress.remove(b.getLocation()); diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AdvancedCargoOutputNode.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AdvancedCargoOutputNode.java index 5b3efc721..54c605294 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AdvancedCargoOutputNode.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AdvancedCargoOutputNode.java @@ -210,8 +210,14 @@ public class AdvancedCargoOutputNode extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AnimalGrowthAccelerator.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AnimalGrowthAccelerator.java index 77c6299d1..c8dd17562 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AnimalGrowthAccelerator.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AnimalGrowthAccelerator.java @@ -70,8 +70,14 @@ public class AnimalGrowthAccelerator extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { me.mrCookieSlime.Slimefun.holograms.AnimalGrowthAccelerator.getArmorStand(b).remove(); - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutoBreeder.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutoBreeder.java index 38e445550..b0642d085 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutoBreeder.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutoBreeder.java @@ -70,8 +70,14 @@ public class AutoBreeder extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { me.mrCookieSlime.Slimefun.holograms.AutoBreeder.getArmorStand(b).remove(); - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutomatedCraftingChamber.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutomatedCraftingChamber.java index d446801af..e875dc6da 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutomatedCraftingChamber.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/AutomatedCraftingChamber.java @@ -119,10 +119,16 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getInputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } return true; diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java index afff95900..8f4ad9bbe 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java @@ -105,8 +105,14 @@ public class CargoCraftingNode extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoInputNode.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoInputNode.java index f02d6e031..90686153d 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoInputNode.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoInputNode.java @@ -236,8 +236,14 @@ public class CargoInputNode extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CropGrowthAccelerator.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CropGrowthAccelerator.java index 60d138860..781bfca20 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CropGrowthAccelerator.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CropGrowthAccelerator.java @@ -80,8 +80,14 @@ public abstract class CropGrowthAccelerator extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { - for (int slot: getInputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getInputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; } diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ElectricSmeltery.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ElectricSmeltery.java index f481901b2..f9c3586f0 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ElectricSmeltery.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ElectricSmeltery.java @@ -102,10 +102,16 @@ public abstract class ElectricSmeltery extends AContainer { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getInputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } progress.remove(b.getLocation()); diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ReactorAccessPort.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ReactorAccessPort.java index 3dd061220..0d50cb497 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ReactorAccessPort.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/ReactorAccessPort.java @@ -81,13 +81,22 @@ public class ReactorAccessPort extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getFuelSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getCoolantSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getOutputSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } return true; diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/WitherAssembler.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/WitherAssembler.java index bebac6219..e840cb664 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/WitherAssembler.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/WitherAssembler.java @@ -130,10 +130,16 @@ public class WitherAssembler extends SlimefunItem { BlockMenu inv = BlockStorage.getInventory(b); if (inv != null) { for (int slot: getSoulSandSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } for (int slot: getWitherSkullSlots()) { - if (inv.getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } } } return true; diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/XPCollector.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/XPCollector.java index b1c448295..70f12376d 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/XPCollector.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/XPCollector.java @@ -69,8 +69,14 @@ public class XPCollector extends SlimefunItem { @Override public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { me.mrCookieSlime.Slimefun.holograms.XPCollector.getArmorStand(b).remove(); - for (int slot: getOutputSlots()) { - if (BlockStorage.getInventory(b).getItemInSlot(slot) != null) b.getWorld().dropItemNaturally(b.getLocation(), BlockStorage.getInventory(b).getItemInSlot(slot)); + BlockMenu inv = BlockStorage.getInventory(b); + if (inv != null) { + for (int slot: getOutputSlots()) { + if (inv.getItemInSlot(slot) != null) { + b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot)); + inv.replaceExistingItem(slot, null); + } + } } return true; }