libreforge-updater

This commit is contained in:
Auxilor 2023-03-29 19:21:20 +01:00
parent 58cbe58c0b
commit dd484ed902
3 changed files with 15 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import com.willfp.ecoenchants.display.EnchantSorter.sortForDisplay
import com.willfp.ecoenchants.enchants.EcoEnchant import com.willfp.ecoenchants.enchants.EcoEnchant
import com.willfp.ecoenchants.enchants.wrap import com.willfp.ecoenchants.enchants.wrap
import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable
import com.willfp.libreforge.ItemProvidedHolder
import org.bukkit.Material import org.bukkit.Material
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.bukkit.inventory.ItemFlag import org.bukkit.inventory.ItemFlag
@ -76,8 +77,9 @@ class EnchantDisplay(private val plugin: EcoEnchantsPlugin) : DisplayModule(plug
var showNotMet = false var showNotMet = false
if (player != null && enchant is EcoEnchant) { if (player != null && enchant is EcoEnchant) {
val enchantLevel = enchant.getLevel(level) val enchantLevel = enchant.getLevel(level)
val holder = ItemProvidedHolder(enchantLevel, itemStack)
val enchantNotMetLines = enchantLevel.conditions.getNotMetLines(player).map { Display.PREFIX + it } val enchantNotMetLines = enchantLevel.conditions.getNotMetLines(player, holder).map { Display.PREFIX + it }
notMetLines.addAll(enchantNotMetLines) notMetLines.addAll(enchantNotMetLines)
if (enchantNotMetLines.isNotEmpty()) { if (enchantNotMetLines.isNotEmpty()) {

View File

@ -4,6 +4,7 @@ import com.github.benmanes.caffeine.cache.Caffeine
import com.willfp.eco.core.fast.fast import com.willfp.eco.core.fast.fast
import com.willfp.ecoenchants.enchants.EcoEnchant import com.willfp.ecoenchants.enchants.EcoEnchant
import com.willfp.ecoenchants.enchants.EcoEnchantLevel import com.willfp.ecoenchants.enchants.EcoEnchantLevel
import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel
import com.willfp.libreforge.ItemProvidedHolder import com.willfp.libreforge.ItemProvidedHolder
import com.willfp.libreforge.ProvidedHolder import com.willfp.libreforge.ProvidedHolder
import org.bukkit.entity.Player import org.bukkit.entity.Player
@ -173,7 +174,9 @@ object EnchantLookup {
for ((slot, enchants) in this.heldEnchantsInSlots) { for ((slot, enchants) in this.heldEnchantsInSlots) {
val inSlot = mutableMapOf<EcoEnchant, Int>() val inSlot = mutableMapOf<EcoEnchant, Int>()
for ((enchant, level) in enchants) { for ((enchant, level) in enchants) {
if (enchant.getLevel(level).conditions.all { it.isMet(this) }) { val enchantLevel = enchant.getLevel(level)
val providedHolder = ItemProvidedHolder(enchantLevel, slot.item)
if (enchantLevel.conditions.areMet(this, providedHolder)) {
inSlot[enchant] = level inSlot[enchant] = level
} }
} }
@ -239,7 +242,11 @@ object EnchantLookup {
return 0 return 0
} }
if (enchant.getLevel(level).conditions.any { !it.isMet(this) }) { val enchantLevel = enchant.getLevel(level)
val item = this.inventory.getItem(slot) ?: return 0
val providedHolder = ItemProvidedHolder(enchantLevel, item)
if (!enchantLevel.conditions.areMet(this, providedHolder)) {
return 0 return 0
} }

View File

@ -1,5 +1,5 @@
#libreforge-updater #libreforge-updater
#Wed Mar 29 15:47:50 BST 2023 #Wed Mar 29 19:21:20 BST 2023
kotlin.code.style=official kotlin.code.style=official
libreforge-version=4.0.0 libreforge-version=4.1.0
version=10.0.0 version=10.1.0