From 51b56b1e0b4e1d6d6aaf31f9bc1f21f0924b70d0 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Mon, 1 Mar 2021 09:30:38 +0100 Subject: [PATCH] Fixes #2851 --- CHANGELOG.md | 1 + .../slimefun4/implementation/items/blocks/OutputChest.java | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e57172aa9..9cf913b17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ * Fixed a duplication glitch with the Woodcutter Android * Fixed #2839 * Fixed #2849 +* Fixed #2851 ## Release Candidate 20 (30 Jan 2021) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/OutputChest.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/OutputChest.java index 89db27a9a..931ad4180 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/OutputChest.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/OutputChest.java @@ -6,8 +6,8 @@ import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.block.Chest; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler; @@ -48,8 +48,9 @@ public class OutputChest extends SimpleSlimefunItem { Block b = e.getBlock(); BlockState state = PaperLib.getBlockState(b, false).getState(); - if (state instanceof InventoryHolder) { - for (ItemStack stack : ((InventoryHolder) state).getInventory()) { + if (state instanceof Chest) { + // Fixes #2851 - Only drop the actual BlockInventory + for (ItemStack stack : ((Chest) state).getBlockInventory()) { if (stack != null && !stack.getType().isAir()) { drops.add(stack); }