mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Fixed bugs with hide stored enchants
This commit is contained in:
parent
c4b71948df
commit
9bff63b3ec
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<EcoEnchant, Slot>()
|
||||
|
||||
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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user