Skip to content

Commit

Permalink
Feature/block drop creative (Slimefun#3934)
Browse files Browse the repository at this point in the history
Co-authored-by: J3fftw <[email protected]>
Co-authored-by: Silent <[email protected]>
  • Loading branch information
3 people authored Dec 31, 2023
1 parent 6b03850 commit dad6020
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand Down Expand Up @@ -240,7 +241,9 @@ private void dropItems(BlockBreakEvent e, List<ItemStack> drops) {
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);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dad6020

Please sign in to comment.