Skip to content

Commit

Permalink
Fixed stack overflow error
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 6, 2024
1 parent 3f3b836 commit 5c6e6ee
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ class ModifiedVanillaCraftEnchantment(
override fun getMaxLevel(): Int = this.vanillaEnchantmentData?.maxLevel ?: super.getMaxLevel()

override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean {
val otherConflicts = when(other) {
is ModifiedVanillaCraftEnchantment -> other.vanillaEnchantmentData?.conflicts?.contains(this.key) == true
else -> other.conflictsWith(this)
}

return this.vanillaEnchantmentData?.conflicts?.contains(other.key) ?: super.conflictsWith(other)
|| other.conflictsWith(this)
|| otherConflicts
}
}

0 comments on commit 5c6e6ee

Please sign in to comment.