mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Added %active_level% and fixed rapid
This commit is contained in:
parent
9086c69f5b
commit
dda1f11c14
@ -28,7 +28,9 @@ import com.willfp.ecoenchants.mechanics.GrindstoneSupport
|
||||
import com.willfp.ecoenchants.mechanics.LootSupport
|
||||
import com.willfp.ecoenchants.mechanics.VillagerSupport
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.clearEnchantCache
|
||||
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.loader.LibreforgePlugin
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||
@ -58,9 +60,12 @@ class EcoEnchantsPlugin : LibreforgePlugin() {
|
||||
override fun handleEnable() {
|
||||
registerHolderProvider { it.heldEnchantLevels }
|
||||
registerPlayerRefreshFunction { it.clearEnchantCache() }
|
||||
registerHolderPlaceholderProvider { (holder, _) ->
|
||||
when (holder) {
|
||||
is EcoEnchantLevel -> listOf(NamedValue("level", holder.level))
|
||||
registerHolderPlaceholderProvider { ph, player ->
|
||||
when (val holder = ph.holder) {
|
||||
is EcoEnchantLevel -> listOf(
|
||||
NamedValue("level", holder.level),
|
||||
NamedValue("active_level", player.getActiveEnchantLevel(holder.enchant))
|
||||
)
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ import com.willfp.libreforge.effects.EffectList
|
||||
import java.util.Objects
|
||||
|
||||
class EcoEnchantLevel(
|
||||
parent: EcoEnchant,
|
||||
val enchant: EcoEnchant,
|
||||
val level: Int,
|
||||
override val effects: EffectList,
|
||||
override val conditions: ConditionList,
|
||||
plugin: EcoPlugin
|
||||
) : Holder {
|
||||
override val id = plugin.createNamespacedKey("${parent.id}_$level")
|
||||
override val id = plugin.createNamespacedKey("${enchant.id}_$level")
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is EcoEnchantLevel) {
|
||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchants.impl
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchant
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.getActiveEnchantLevel
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
@ -31,7 +32,7 @@ class EnchantmentRapid(
|
||||
fun handle(event: EntityShootBowEvent) {
|
||||
val player = event.entity as? Player ?: return
|
||||
|
||||
val level = player.getEnchantLevel(enchant)
|
||||
val level = player.getActiveEnchantLevel(enchant)
|
||||
|
||||
val multiplier = 1 - enchant.config.getDouble("percent-faster-per-level") * level / 100
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#libreforge-updater
|
||||
#Wed May 24 14:58:23 BST 2023
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.16.1
|
||||
libreforge-version=4.17.0
|
||||
version=10.16.1
|
||||
|
Loading…
Reference in New Issue
Block a user