From 3917f1430cd9a07a88ef0aaf19e97aa6dc8cd16c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 21 Aug 2021 20:18:10 +0100 Subject: [PATCH] Fixed blast mining and lumberjack using durability in creative --- .../enchantments/ecoenchants/normal/BlastMining.java | 3 ++- .../enchantments/ecoenchants/normal/Lumberjack.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 5caccebe..8f97e46f 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 @@ -8,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.block.Block; @@ -93,7 +94,7 @@ public class BlastMining extends EcoEnchant { ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemMeta beforeMeta = itemStack.getItemMeta(); assert beforeMeta != null; - boolean hadUnbreak = beforeMeta.isUnbreakable(); + boolean hadUnbreak = beforeMeta.isUnbreakable() || player.getGameMode() == GameMode.CREATIVE; beforeMeta.setUnbreakable(true); itemStack.setItemMeta(beforeMeta); int blocks = toBreak.size(); diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java index c80dd971..e1987a44 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java @@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -59,7 +60,7 @@ public class Lumberjack extends EcoEnchant { ItemStack itemStack = player.getInventory().getItemInMainHand(); ItemMeta beforeMeta = itemStack.getItemMeta(); assert beforeMeta != null; - boolean hadUnbreak = beforeMeta.isUnbreakable(); + boolean hadUnbreak = beforeMeta.isUnbreakable() || player.getGameMode() == GameMode.CREATIVE; beforeMeta.setUnbreakable(true); itemStack.setItemMeta(beforeMeta); int blocks = treeBlocks.size();