From cd91978a6314c6c5d9ff653cd16b54b296fa5379 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 15 Mar 2022 13:09:22 +0000 Subject: [PATCH] Updated block breaking --- .../enchantments/ecoenchants/normal/Drill.java | 3 +-- .../enchantments/ecoenchants/spell/Dynamite.java | 8 ++------ .../ecoenchants/enchantments/util/EnchantmentUtils.java | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java index ba15f38d..43a20441 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java @@ -2,7 +2,6 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; import com.willfp.eco.core.integrations.anticheat.AnticheatManager; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.BlockUtils; import com.willfp.eco.util.VectorUtils; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; @@ -64,7 +63,7 @@ public class Drill extends EcoEnchant { continue; } - BlockUtils.breakBlock(player, block1); + player.breakBlock(block1); block1.removeMetadata("block-ignore", this.getPlugin()); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java index 2732a851..f7f34a47 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java @@ -2,9 +2,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.spell; import com.willfp.eco.core.integrations.anticheat.AnticheatManager; import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.BlockUtils; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.itemtypes.Spell; +import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -72,11 +72,7 @@ public class Dynamite extends Spell { } } - toBreak.forEach((block1 -> { - block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - BlockUtils.breakBlock(player, block1); - block1.removeMetadata("block-ignore", this.getPlugin()); - })); + EnchantmentUtils.rehandleBreaking(player, toBreak, this.getPlugin()); AnticheatManager.unexemptPlayer(player); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java index f59f6a19..4dc2451e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java @@ -3,7 +3,6 @@ package com.willfp.ecoenchants.enchantments.util; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; import com.willfp.eco.core.placeholder.PlayerPlaceholder; -import com.willfp.eco.util.BlockUtils; import com.willfp.eco.util.NumberUtils; import com.willfp.eco.util.StringUtils; import com.willfp.ecoenchants.EcoEnchantsPlugin; @@ -185,7 +184,7 @@ public class EnchantmentUtils { @NotNull final EcoPlugin plugin) { for (Block block : toBreak) { block.setMetadata("block-ignore", plugin.getMetadataValueFactory().create(true)); - BlockUtils.breakBlock(player, block); + player.breakBlock(block); block.removeMetadata("block-ignore", plugin); } }