diff --git a/eco-core/core-nms/v1_21/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_21/HideStoredEnchants.kt b/eco-core/core-nms/v1_21/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_21/HideStoredEnchants.kt index 6b951c48..88dd1092 100644 --- a/eco-core/core-nms/v1_21/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_21/HideStoredEnchants.kt +++ b/eco-core/core-nms/v1_21/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_21/HideStoredEnchants.kt @@ -1,19 +1,33 @@ package com.willfp.ecoenchants.proxy.v1_21 +import com.willfp.eco.core.Prerequisite import com.willfp.eco.core.fast.FastItemStack import com.willfp.ecoenchants.display.HideStoredEnchantsProxy import org.bukkit.inventory.ItemFlag +import javax.print.attribute.PrintRequestAttribute class HideStoredEnchants: HideStoredEnchantsProxy { override fun hideStoredEnchants(fis: FastItemStack) { - fis.addItemFlags(ItemFlag.HIDE_STORED_ENCHANTS) + if (Prerequisite.HAS_PAPER.isMet) { + fis.addItemFlags(ItemFlag.HIDE_STORED_ENCHANTS) + } else { + fis.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP) + } } override fun areStoredEnchantsHidden(fis: FastItemStack): Boolean { - return fis.hasItemFlag(ItemFlag.HIDE_STORED_ENCHANTS) + return if (Prerequisite.HAS_PAPER.isMet) { + fis.hasItemFlag(ItemFlag.HIDE_STORED_ENCHANTS) + } else { + fis.hasItemFlag(ItemFlag.HIDE_ADDITIONAL_TOOLTIP) + } } override fun showStoredEnchants(fis: FastItemStack) { - fis.removeItemFlags(ItemFlag.HIDE_STORED_ENCHANTS) + if (Prerequisite.HAS_PAPER.isMet) { + fis.removeItemFlags(ItemFlag.HIDE_STORED_ENCHANTS) + } else { + fis.removeItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP) + } } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt index ee728389..618ac899 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchant/EnchantGUI.kt @@ -1,6 +1,7 @@ package com.willfp.ecoenchants.enchant import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.Prerequisite import com.willfp.eco.core.config.base.LangYml import com.willfp.eco.core.drops.DropQueue import com.willfp.eco.core.fast.fast @@ -24,6 +25,7 @@ import com.willfp.eco.util.formatEco import com.willfp.eco.util.lineWrap import com.willfp.ecoenchants.EcoEnchantsPlugin import com.willfp.ecoenchants.display.EnchantSorter.sortForDisplay +import com.willfp.ecoenchants.display.HideStoredEnchantsProxy import com.willfp.ecoenchants.display.getFormattedDescription import com.willfp.ecoenchants.display.getFormattedName import com.willfp.ecoenchants.target.EnchantmentTargets.applicableEnchantments @@ -206,7 +208,7 @@ private val cachedEnchantmentSlots = Caffeine.newBuilder() .build() private fun EcoEnchant.getInformationSlot(plugin: EcoEnchantsPlugin, player: Player): Slot { - return cachedEnchantmentSlots.get(this) { + return cachedEnchantmentSlots.get(this) { it -> val level = if (plugin.configYml.getBool("enchantinfo.item.show-max-level")) { it.maximumLevel } else { @@ -248,6 +250,11 @@ private fun EcoEnchant.getInformationSlot(plugin: EcoEnchantsPlugin, player: Pla } } .build() + .fast() + .apply { + plugin.getProxy(HideStoredEnchantsProxy::class.java).hideStoredEnchants(this) + } + .unwrap() ) } }