fix small issue

This commit is contained in:
alexcrea 2025-07-24 04:30:52 +02:00
parent 65d6af7672
commit d03d2a0444
Signed by: alexcrea
GPG key ID: E346CD16413450E3

View file

@ -351,7 +351,7 @@ object ConfigOptions {
fun getEnchantCountLimit(type: Material): Int? {
val limit = materialEnchantCountLimit(type)
if(limit >= 0) return limit
if(limit != null) return limit
if(defaultEnchantCountLimit >= 0) return defaultEnchantCountLimit
return DependencyManager.ecoEnchantCompatibility?.getEcoLevelLimit()
@ -362,11 +362,10 @@ object ConfigOptions {
*
* @return The current enchantment limit. -1 if none
*/
private fun materialEnchantCountLimit(type: Material): Int {
private fun materialEnchantCountLimit(type: Material): Int? {
return ConfigHolder.DEFAULT_CONFIG.config
.getInt(ENCHANT_COUNT_LIMIT_ITEMS, DEFAULT_ENCHANT_COUNT_LIMIT)
.getInt("$ENCHANT_COUNT_LIMIT_ITEMS.${type.key.key.lowercase()}", DEFAULT_ENCHANT_COUNT_LIMIT)
.takeIf { it in ENCHANT_COUNT_LIMIT_RANGE }
?: DEFAULT_ENCHANT_COUNT_LIMIT
}
/**
* User configured default enchantment count limit