mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge pull request #3940 from J3fftw1/fix/items-adder-dupe
Fixes duplication glitch with explosive tools in combination with itemsadder
This commit is contained in:
commit
d683a6337c
@ -6,6 +6,7 @@ import java.util.List;
|
||||
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;
|
||||
@ -83,6 +84,10 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
|
||||
if (!blockExplodeEvent.isCancelled()) {
|
||||
for (Block block : blockExplodeEvent.blockList()) {
|
||||
if (canBreak(p, block)) {
|
||||
if (Slimefun.getIntegrations().isCustomBlock(block)) {
|
||||
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
|
||||
CustomBlock.remove(block.getLocation());
|
||||
}
|
||||
blocksToDestroy.add(block);
|
||||
}
|
||||
}
|
||||
@ -90,6 +95,10 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
|
||||
} else {
|
||||
for (Block block : blocks) {
|
||||
if (canBreak(p, block)) {
|
||||
if (Slimefun.getIntegrations().isCustomBlock(block)) {
|
||||
drops.addAll(CustomBlock.byAlreadyPlaced(block).getLoot());
|
||||
CustomBlock.remove(block.getLocation());
|
||||
}
|
||||
blocksToDestroy.add(block);
|
||||
}
|
||||
}
|
||||
@ -137,8 +146,6 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
|
||||
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);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.logging.Level;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import dev.lone.itemsadder.api.CustomBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@ -236,7 +237,7 @@ public class IntegrationsManager {
|
||||
public boolean isCustomBlock(@Nonnull Block block) {
|
||||
if (isItemsAdderInstalled) {
|
||||
try {
|
||||
return ItemsAdder.isCustomBlock(block);
|
||||
return CustomBlock.byAlreadyPlaced(block) != null;
|
||||
} catch (Exception | LinkageError x) {
|
||||
logError("ItemsAdder", x);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user