Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
we now actually drop
Browse files Browse the repository at this point in the history
  • Loading branch information
J3fftw1 committed Sep 3, 2023
1 parent e4bd5b1 commit 6d70544
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import dev.lone.itemsadder.api.CustomBlock;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
Expand Down Expand Up @@ -35,9 +36,9 @@

/**
* This {@link SlimefunItem} is a super class for items like the {@link ExplosivePickaxe} or {@link ExplosiveShovel}.
*
*
* @author TheBusyBiscuit
*
*
* @see ExplosivePickaxe
* @see ExplosiveShovel
*
Expand Down Expand Up @@ -83,13 +84,21 @@ private void breakBlocks(BlockBreakEvent e, Player p, ItemStack item, Block b, L
if (!blockExplodeEvent.isCancelled()) {
for (Block block : blockExplodeEvent.blockList()) {
if (canBreak(p, block)) {
if (CustomBlock.byAlreadyPlaced(block) != null) {
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
CustomBlock.remove(block.getLocation());
}
blocksToDestroy.add(block);
}
}
}
} else {
for (Block block : blocks) {
if (canBreak(p, block)) {
if (CustomBlock.byAlreadyPlaced(block) != null) {
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
CustomBlock.remove(block.getLocation());
}
blocksToDestroy.add(block);
}
}
Expand Down Expand Up @@ -137,8 +146,6 @@ protected boolean canBreak(@Nonnull Player p, @Nonnull Block b) {
return false;
} else if (!b.getWorld().getWorldBorder().isInside(b.getLocation())) {
return false;
} else if (Slimefun.getIntegrations().isCustomBlock(b)) {
return false;
} else {
return Slimefun.getProtectionManager().hasPermission(p, b.getLocation(), Interaction.BREAK_BLOCK);
}
Expand Down

0 comments on commit 6d70544

Please sign in to comment.