add per item enchant count limit

This commit is contained in:
alexcrea 2025-07-23 12:44:39 +02:00
parent b095cd5316
commit 65d6af7672
Signed by: alexcrea
GPG key ID: E346CD16413450E3
3 changed files with 54 additions and 4 deletions

View file

@ -34,9 +34,8 @@ object EnchantmentUtil {
val bypassFuse = player.hasPermission(CustomAnvil.bypassFusePermission)
val bypassLevel = player.hasPermission(CustomAnvil.bypassLevelPermission)
// TODO add custom anvil maximum enchant count per item and globally too
var maxEnchantCount = DependencyManager.ecoEnchantCompatibility?.getEcoLevelLimit()
if(maxEnchantCount == null || maxEnchantCount < 0) maxEnchantCount = Int.MAX_VALUE;
var maxEnchantCount = ConfigOptions.getEnchantCountLimit(item.type)
if(maxEnchantCount == null || maxEnchantCount < 0) maxEnchantCount = Int.MAX_VALUE
other.forEach { (enchantment, level) ->
if(!enchantment.isAllowed(player)) return@forEach