From dad6020680bda143fb998020c33aa2270186b0f5 Mon Sep 17 00:00:00 2001 From: Silent <46107752+TheSilentPro@users.noreply.github.com> Date: Sun, 31 Dec 2023 09:58:28 +0100 Subject: [PATCH] Feature/block drop creative (#3934) Co-authored-by: J3fftw <44972470+J3fftw1@users.noreply.github.com> Co-authored-by: Silent --- .../slimefun4/implementation/listeners/BlockListener.java | 5 ++++- src/main/resources/config.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 91fb9eb29..1db923beb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -11,6 +11,7 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -240,7 +241,9 @@ public class BlockListener implements Listener { for (ItemStack drop : drops) { // Prevent null or air from being dropped if (drop != null && drop.getType() != Material.AIR) { - e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), drop); + if (e.getPlayer().getGameMode() != GameMode.CREATIVE || Slimefun.getCfg().getBoolean("options.drop-block-creative")) { + e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), drop); + } } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ece2aa341..cb133170e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -22,6 +22,7 @@ options: burn-players-when-radioactive: true drop-excess-sf-give-items: false backup-data: true + drop-block-creative: true guide: show-vanilla-recipes: true