mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Improved canEnchantItem
This commit is contained in:
parent
b903657a38
commit
27b351858f
@ -15,6 +15,7 @@ import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.eco.util.containsIgnoreCase
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin
|
||||
import com.willfp.ecoenchants.display.getFormattedName
|
||||
import com.willfp.ecoenchants.mechanics.infiniteIfNegative
|
||||
import com.willfp.ecoenchants.rarity.EnchantmentRarities
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel
|
||||
import com.willfp.ecoenchants.target.EnchantmentTargets
|
||||
@ -236,6 +237,10 @@ abstract class EcoEnchant(
|
||||
return false
|
||||
}
|
||||
|
||||
if (item.fast().getEnchants(true).size >= plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) {
|
||||
return true
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.willfp.eco.core.placeholder.PlaceholderInjectable
|
||||
import com.willfp.eco.core.placeholder.StaticPlaceholder
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin
|
||||
import com.willfp.ecoenchants.mechanics.infiniteIfNegative
|
||||
import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy
|
||||
import com.willfp.ecoenchants.rarity.EnchantmentRarities
|
||||
import com.willfp.ecoenchants.rarity.EnchantmentRarity
|
||||
@ -122,6 +123,10 @@ class VanillaEcoEnchantLike(
|
||||
return false
|
||||
}
|
||||
|
||||
if (item.fast().getEnchants(true).size >= plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) {
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user