From 5c6e6ee49ef4416a3d25e36eca4fa6ee87d9aa43 Mon Sep 17 00:00:00 2001 From: Will FP Date: Sat, 6 Jan 2024 10:01:36 +0000 Subject: [PATCH] Fixed stack overflow error --- .../registration/ModifiedVanillaCraftEnchantment.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/ModifiedVanillaCraftEnchantment.kt b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/ModifiedVanillaCraftEnchantment.kt index 23c30eff..2aed4392 100644 --- a/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/ModifiedVanillaCraftEnchantment.kt +++ b/eco-core/core-nms/v1_20_R3/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_20_R3/registration/ModifiedVanillaCraftEnchantment.kt @@ -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 } }