Fixed blast mining and lumberjack using durability in creative

This commit is contained in:
Auxilor 2021-08-21 20:18:10 +01:00
parent 3ddc405815
commit 3917f1430c
2 changed files with 4 additions and 2 deletions

View File

@ -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();

View File

@ -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();