diff --git a/src/main/java/cn/lunadeer/liteworldedit/Jobs/Job.java b/src/main/java/cn/lunadeer/liteworldedit/Jobs/Job.java index 9e278b3..1b14fd8 100644 --- a/src/main/java/cn/lunadeer/liteworldedit/Jobs/Job.java +++ b/src/main/java/cn/lunadeer/liteworldedit/Jobs/Job.java @@ -91,9 +91,11 @@ public class Job { } // 如果耐久小于10,提示玩家 pickaxe_damage = (Damageable) pickaxe_meta; - if (pickaxe_damage.getDamage() >= 2031 - 10) { - LoggerX.debug(index + " 下界合金镐耐久太低!"); - continue; + if (!pickaxe_meta.isUnbreakable()) { + if (pickaxe_damage.getDamage() >= 2031 - 10) { + LoggerX.debug(index + " 下界合金镐耐久太低!"); + continue; + } } pickaxe = p; break; @@ -104,9 +106,13 @@ public class Job { public static ItemStack useNetherPickaxe(ItemStack pickaxe) { int durability = pickaxe.getEnchantmentLevel(Enchantment.DURABILITY); double random = Math.random(); + Damageable pickaxe_damage = (Damageable) pickaxe.getItemMeta(); + if (pickaxe_damage.isUnbreakable()) { + // 无限耐久则不损坏 + return pickaxe; + } if (random < 1.0 / (durability + 1)) { // 扣除耐久 - Damageable pickaxe_damage = (Damageable) pickaxe.getItemMeta(); pickaxe_damage.setDamage(pickaxe_damage.getDamage() + 1); pickaxe.setItemMeta(pickaxe_damage); } diff --git a/src/main/java/cn/lunadeer/liteworldedit/Jobs/Remove.java b/src/main/java/cn/lunadeer/liteworldedit/Jobs/Remove.java index ad90dab..00da5b1 100644 --- a/src/main/java/cn/lunadeer/liteworldedit/Jobs/Remove.java +++ b/src/main/java/cn/lunadeer/liteworldedit/Jobs/Remove.java @@ -34,7 +34,7 @@ public class Remove extends Job { } // 获取玩家背包中的下届合金镐 HashMap pickaxes = getNetherPickaxes(_creator); - if (pickaxes.size() == 0) { + if (pickaxes.isEmpty()) { return JobErrCode.NO_PICKAXE; } ItemStack pickaxe = getUsableNetherPickaxe(pickaxes, _creator);