Fixed stack overflow error

This commit is contained in:
Will FP 2024-01-06 10:01:36 +00:00
parent 3f3b836232
commit 5c6e6ee49e

View File

@ -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
}
}