Skip to content

Commit

Permalink
fix: don't break item with unbreakable
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Nov 5, 2023
1 parent f54b198 commit 88d7e75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.7.10"
version = "6.7.11"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.Damageable

fun ItemStack.damage(player: Player? = null, amount: Int = 1, checkDurabilityEnchantment: Boolean = false, consumeIfNotDamageable: Boolean = true) {
if (itemMeta?.isUnbreakable == true) return
if (itemMeta !is Damageable || type.maxDurability.toInt() == 0) {
if (!consumeIfNotDamageable) error("item is not damageable and consumeIfNotDamageable is false")
this.amount--
Expand Down

0 comments on commit 88d7e75

Please sign in to comment.