mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Updated holder placeholder provider
This commit is contained in:
parent
dda1f11c14
commit
7fe0487294
@ -32,11 +32,13 @@ import com.willfp.ecoenchants.target.EnchantLookup.getActiveEnchantLevel
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.heldEnchantLevels
|
||||
import com.willfp.libreforge.EmptyProvidedHolder.holder
|
||||
import com.willfp.libreforge.NamedValue
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
import com.willfp.libreforge.loader.LibreforgePlugin
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||
import com.willfp.libreforge.registerHolderPlaceholderProvider
|
||||
import com.willfp.libreforge.registerHolderProvider
|
||||
import com.willfp.libreforge.registerPlayerRefreshFunction
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.Listener
|
||||
|
||||
class EcoEnchantsPlugin : LibreforgePlugin() {
|
||||
@ -60,14 +62,11 @@ class EcoEnchantsPlugin : LibreforgePlugin() {
|
||||
override fun handleEnable() {
|
||||
registerHolderProvider { it.heldEnchantLevels }
|
||||
registerPlayerRefreshFunction { it.clearEnchantCache() }
|
||||
registerHolderPlaceholderProvider { ph, player ->
|
||||
when (val holder = ph.holder) {
|
||||
is EcoEnchantLevel -> listOf(
|
||||
NamedValue("level", holder.level),
|
||||
NamedValue("active_level", player.getActiveEnchantLevel(holder.enchant))
|
||||
)
|
||||
else -> emptyList()
|
||||
}
|
||||
registerHolderPlaceholderProvider<EcoEnchantLevel> { it, player ->
|
||||
listOf(
|
||||
NamedValue("level", it.level),
|
||||
NamedValue("active_level", player.getActiveEnchantLevel(it.enchant))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user