From 2288be888eebba9508ce66d0fe06d5919855fd13 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 20 Mar 2021 18:19:55 +0000 Subject: [PATCH] Added option to have blast mining be chanced based --- .../enchantments/ecoenchants/normal/BlastMining.java | 5 +++++ .../src/main/resources/enchants/normal/blastmining.yml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java index 43f27ef7..4b5adc94 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java @@ -6,6 +6,7 @@ import com.willfp.eco.util.integrations.antigrief.AntigriefManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; +import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -31,6 +32,10 @@ public class BlastMining extends EcoEnchant { return; } + if (!EnchantmentUtils.passedChance(this, level)) { + return; + } + if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { return; } diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml index 98fc16f6..227e7f40 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml @@ -20,8 +20,10 @@ general-config: conflicts: - drill - vein + maximum-level: 1 config: + chance-per-level: 100 disable-on-sneak: true enable-sound: true # Play explosion sound hardness-check: true # Only break blocks with hardness less than or equal to first block