1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

we now actually drop

This commit is contained in:
Jeffrey 2023-09-03 17:45:08 +02:00
parent e4bd5b1640
commit 6d70544bb7
No known key found for this signature in database
GPG Key ID: 90F6887F79A113A3

View File

@ -6,6 +6,7 @@ import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;
import dev.lone.itemsadder.api.CustomBlock;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
@ -35,9 +36,9 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
/** /**
* This {@link SlimefunItem} is a super class for items like the {@link ExplosivePickaxe} or {@link ExplosiveShovel}. * This {@link SlimefunItem} is a super class for items like the {@link ExplosivePickaxe} or {@link ExplosiveShovel}.
* *
* @author TheBusyBiscuit * @author TheBusyBiscuit
* *
* @see ExplosivePickaxe * @see ExplosivePickaxe
* @see ExplosiveShovel * @see ExplosiveShovel
* *
@ -83,6 +84,10 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
if (!blockExplodeEvent.isCancelled()) { if (!blockExplodeEvent.isCancelled()) {
for (Block block : blockExplodeEvent.blockList()) { for (Block block : blockExplodeEvent.blockList()) {
if (canBreak(p, block)) { if (canBreak(p, block)) {
if (CustomBlock.byAlreadyPlaced(block) != null) {
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
CustomBlock.remove(block.getLocation());
}
blocksToDestroy.add(block); blocksToDestroy.add(block);
} }
} }
@ -90,6 +95,10 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
} else { } else {
for (Block block : blocks) { for (Block block : blocks) {
if (canBreak(p, block)) { if (canBreak(p, block)) {
if (CustomBlock.byAlreadyPlaced(block) != null) {
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
CustomBlock.remove(block.getLocation());
}
blocksToDestroy.add(block); blocksToDestroy.add(block);
} }
} }
@ -137,8 +146,6 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
return false; return false;
} else if (!b.getWorld().getWorldBorder().isInside(b.getLocation())) { } else if (!b.getWorld().getWorldBorder().isInside(b.getLocation())) {
return false; return false;
} else if (Slimefun.getIntegrations().isCustomBlock(b)) {
return false;
} else { } else {
return Slimefun.getProtectionManager().hasPermission(p, b.getLocation(), Interaction.BREAK_BLOCK); return Slimefun.getProtectionManager().hasPermission(p, b.getLocation(), Interaction.BREAK_BLOCK);
} }