From d842668f372e3d30e6cf0363ceffcecccf287304 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Sun, 9 Oct 2022 01:14:49 +0300 Subject: [PATCH] Added ability to add libreforge conditions for effects --- build.gradle | 2 +- .../com/willfp/ecoskills/effects/Effect.kt | 7 +++ .../effects/EffectAcceleratedEscape.kt | 4 ++ .../effects/effects/EffectBountifulHarvest.kt | 4 ++ .../effects/effects/EffectBravery.kt | 4 ++ .../effects/effects/EffectCraftsmanship.kt | 4 ++ .../ecoskills/effects/effects/EffectDazzle.kt | 4 ++ .../effects/effects/EffectDodging.kt | 4 ++ .../effects/effects/EffectDynamicMining.kt | 4 ++ .../effects/effects/EffectEfficientBrewing.kt | 4 ++ .../effects/effects/EffectEndangering.kt | 4 ++ .../effects/effects/EffectEyeOfTheDepths.kt | 4 ++ .../effects/effects/EffectGoldenYield.kt | 4 ++ .../effects/EffectInfernalResistance.kt | 4 ++ .../effects/effects/EffectMagneticRod.kt | 4 ++ .../effects/effects/EffectMasterLumberjack.kt | 4 ++ .../effects/effects/EffectMysticResilience.kt | 4 ++ .../effects/effects/EffectOvercompensation.kt | 4 ++ .../effects/effects/EffectPotionmaster.kt | 4 ++ .../effects/effects/EffectReimbursement.kt | 3 ++ .../effects/effects/EffectSatiation.kt | 4 ++ .../effects/effects/EffectSeamlessMovement.kt | 4 ++ .../effects/effects/EffectSecondChance.kt | 4 ++ .../effects/effects/EffectSerratedStrikes.kt | 4 ++ .../effects/effects/EffectShamanism.kt | 4 ++ .../effects/effects/EffectSpelunking.kt | 4 ++ .../effects/effects/EffectStrongImpact.kt | 4 ++ .../effects/effects/EffectVersatileTools.kt | 4 ++ .../src/main/resources/effects.yml | 52 +++++++++++++++++++ 29 files changed, 163 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6a4e212..f588244 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:6.42.0' + compileOnly 'com.willfp:eco:6.43.6' implementation 'com.willfp:libreforge:3.110.0' implementation 'org.joml:joml:1.10.4' compileOnly fileTree(dir: '../../lib', include: ['*.jar']) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt index db2f155..2b4d047 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt @@ -9,7 +9,9 @@ import com.willfp.eco.util.StringUtils import com.willfp.ecoskills.EcoSkillsPlugin import com.willfp.ecoskills.SkillObject import com.willfp.ecoskills.getEffectLevel +import com.willfp.libreforge.conditions.Conditions import org.bukkit.NamespacedKey +import org.bukkit.entity.Player import org.bukkit.event.Listener import java.util.* @@ -74,4 +76,9 @@ abstract class Effect( "${id}_description" ) { player -> this.getDescription(player.getEffectLevel(this)) }.register() } + + protected fun checkConditions(player: Player): Boolean { + return this.config.getSubsections("conditions").map { Conditions.compile(it, + "Condition for effect: ${this.key.key}") }.all { it?.isMet(player)?: true } + } } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectAcceleratedEscape.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectAcceleratedEscape.kt index 5e2de7d..4ae60a6 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectAcceleratedEscape.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectAcceleratedEscape.kt @@ -29,6 +29,10 @@ class EffectAcceleratedEscape: Effect( return } + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) val modifier = AttributeModifier( diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt index 4d76604..a38f877 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt @@ -30,6 +30,10 @@ class EffectBountifulHarvest : DropMultiplierEffect( return } + if (!this.checkConditions(event.player)) { + return + } + val mat = blockMap[event.block.location] ?: return val state = event.blockState.blockData as? Ageable ?: return diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBravery.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBravery.kt index 4b7cad1..e263cd4 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBravery.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBravery.kt @@ -32,6 +32,10 @@ class EffectBravery: Effect( return } + if (!this.checkConditions(player)) { + return + } + if (event.damager !is Boss && event.damager !is ElderGuardian && !event.damager.persistentDataContainer.has(NamespacedKeyUtils.create("ecobosses", "boss"), PersistentDataType.STRING)) { return diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectCraftsmanship.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectCraftsmanship.kt index 58bee2e..fffbb67 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectCraftsmanship.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectCraftsmanship.kt @@ -22,6 +22,10 @@ class EffectCraftsmanship : Effect( val player = event.player + if (!this.checkConditions(player)) { + return + } + if (!event.item.type.toString().lowercase().contains("axe")) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDazzle.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDazzle.kt index d74ef4f..48b40da 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDazzle.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDazzle.kt @@ -30,6 +30,10 @@ class EffectDazzle : Effect( val player = event.damager.tryAsPlayer() ?: return val victim = if (event.entity is LivingEntity) event.entity as LivingEntity else return + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDodging.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDodging.kt index deeab41..921bb4e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDodging.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDodging.kt @@ -27,6 +27,10 @@ class EffectDodging: Effect( return } + if (!this.checkConditions(player)) { + return + } + if (event.cause == EntityDamageEvent.DamageCause.FALL) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDynamicMining.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDynamicMining.kt index 6999b1f..d5b4067 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDynamicMining.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectDynamicMining.kt @@ -28,6 +28,10 @@ class EffectDynamicMining : Effect( val player = event.player + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEfficientBrewing.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEfficientBrewing.kt index 3b99111..2d5d32a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEfficientBrewing.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEfficientBrewing.kt @@ -29,6 +29,10 @@ class EffectEfficientBrewing : Effect( return } + if (!this.checkConditions(player)) { + return + } + if (player.getEffectLevel(this) == 0) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEndangering.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEndangering.kt index ec334dc..080fe53 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEndangering.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEndangering.kt @@ -26,6 +26,10 @@ class EffectEndangering : Effect( val player = event.damager.tryAsPlayer() ?: return val victim = if (event.entity is LivingEntity) event.entity as LivingEntity else return + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt index 6a58ee7..468f855 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt @@ -32,6 +32,10 @@ class EffectEyeOfTheDepths: Effect( return } + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) val chance = config.getDouble("chance-per-level") * level diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectGoldenYield.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectGoldenYield.kt index 47c1f05..bc6af0e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectGoldenYield.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectGoldenYield.kt @@ -26,6 +26,10 @@ class EffectGoldenYield: Effect( val block = event.block val player = event.player + if (!this.checkConditions(player)) { + return + } + val data = block.blockData if (data !is Ageable) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectInfernalResistance.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectInfernalResistance.kt index 82c2c13..428c74f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectInfernalResistance.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectInfernalResistance.kt @@ -27,6 +27,10 @@ class EffectInfernalResistance: Effect( return } + if (!this.checkConditions(player)) { + return + } + if (event.cause != EntityDamageEvent.DamageCause.FIRE && event.cause != EntityDamageEvent.DamageCause.FIRE_TICK && event.cause != EntityDamageEvent.DamageCause.LAVA diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMagneticRod.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMagneticRod.kt index f955267..44cf1de 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMagneticRod.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMagneticRod.kt @@ -26,6 +26,10 @@ class EffectMagneticRod : Effect( val player = event.player + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (level == 0) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt index e30b064..b5b2e17 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt @@ -34,6 +34,10 @@ class EffectMasterLumberjack : DropMultiplierEffect( val player = event.player + if (!this.checkConditions(player)) { + return + } + val block = event.block if (BlockUtils.isPlayerPlaced(block)) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMysticResilience.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMysticResilience.kt index d22f839..7ce6638 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMysticResilience.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMysticResilience.kt @@ -28,6 +28,10 @@ class EffectMysticResilience : Effect( return } + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) >= this.config.getDouble("chance-per-level") * level) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectOvercompensation.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectOvercompensation.kt index 42a3582..3a9f88a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectOvercompensation.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectOvercompensation.kt @@ -26,6 +26,10 @@ class EffectOvercompensation : Effect( val player = event.enchanter val cost = event.whichButton() + 1 + if (!this.checkConditions(player)) { + return + } + val chance = config.getDouble("chance-per-level") * player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) < chance) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt index b4ca91b..6671c4d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt @@ -34,6 +34,10 @@ class EffectPotionmaster : Effect( val player = event.contents.viewers.filterIsInstance().firstOrNull() ?: return + if (!this.checkConditions(player)) { + return + } + if (player.getEffectLevel(this) == 0) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectReimbursement.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectReimbursement.kt index be21d75..edf555d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectReimbursement.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectReimbursement.kt @@ -21,6 +21,9 @@ class EffectReimbursement : Effect( } val player = event.enchanter + if (!this.checkConditions(player)) { + return + } val cost = event.whichButton()+1 val chance = config.getDouble("chance-per-level") * player.getEffectLevel(this) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSatiation.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSatiation.kt index e4bb08c..b632843 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSatiation.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSatiation.kt @@ -27,6 +27,10 @@ class EffectSatiation: Effect( return } + if (!this.checkConditions(player)) { + return + } + if (event.foodLevel > player.foodLevel) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSeamlessMovement.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSeamlessMovement.kt index 510e75d..64f9890 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSeamlessMovement.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSeamlessMovement.kt @@ -27,6 +27,10 @@ class EffectSeamlessMovement: Effect( return } + if (!this.checkConditions(player)) { + return + } + if (event.cause != EntityDamageEvent.DamageCause.FALL) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSecondChance.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSecondChance.kt index 8c5f46f..13a14ec 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSecondChance.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSecondChance.kt @@ -25,6 +25,10 @@ class EffectSecondChance: Effect( val item = event.item val meta = item.itemMeta + if (!this.checkConditions(player)) { + return + } + if (meta !is Damageable) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt index 1498afb..9edc302 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSerratedStrikes.kt @@ -32,6 +32,10 @@ class EffectSerratedStrikes : Effect( return } + if (!this.checkConditions(player)) { + return + } + if (!AntigriefManager.canInjure(player, victim)) { return } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectShamanism.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectShamanism.kt index 6178e6a..5ab7727 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectShamanism.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectShamanism.kt @@ -27,6 +27,10 @@ class EffectShamanism: Effect( return } + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) var multiplier = config.getDouble("percent-faster-per-level") * level diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt index 9e1db91..417403f 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt @@ -33,6 +33,10 @@ class EffectSpelunking : DropMultiplierEffect( val player = event.player + if (!this.checkConditions(player)) { + return + } + val block = event.block if (BlockUtils.isPlayerPlaced(block)) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectStrongImpact.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectStrongImpact.kt index 69f4aaf..9675f2d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectStrongImpact.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectStrongImpact.kt @@ -24,6 +24,10 @@ class EffectStrongImpact : Effect( val player = event.damager.tryAsPlayer() ?: return + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) if (NumberUtils.randFloat(0.0, 100.0) >= config.getDouble("chance-per-level") * level) { diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectVersatileTools.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectVersatileTools.kt index 8fc2914..c71c2ed 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectVersatileTools.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectVersatileTools.kt @@ -31,6 +31,10 @@ class EffectVersatileTools: Effect( return } + if (!this.checkConditions(player)) { + return + } + val level = player.getEffectLevel(this) var multiplier = config.getDouble("percent-more-per-level") * level diff --git a/eco-core/core-plugin/src/main/resources/effects.yml b/eco-core/core-plugin/src/main/resources/effects.yml index 96b6c16..574feb7 100644 --- a/eco-core/core-plugin/src/main/resources/effects.yml +++ b/eco-core/core-plugin/src/main/resources/effects.yml @@ -20,6 +20,8 @@ bountiful_harvest: chance-per-level: 8 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] versatile_tools: description: "&8Deal &a%percent_more%%&8 more damage with pickaxes" @@ -27,6 +29,8 @@ versatile_tools: percent-more-per-level: 4 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] eye_of_the_depths: description: "&a%chance%%&8 chance to get rare drops from fishing" @@ -52,6 +56,8 @@ eye_of_the_depths: - ecoarmor:set_miner_leggings - ecoarmor:set_miner_boots - reforges:dynamic + # Conditions + conditions: [ ] serrated_strikes: description: "&a%chance%%&8 chance to make your opponent bleed" @@ -65,6 +71,8 @@ serrated_strikes: bleed-ticks: 4 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] seamless_movement: description: "&a%chance%%&8 chance to ignore fall damage" @@ -72,6 +80,8 @@ seamless_movement: chance-per-level: 2 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] potionmaster: description: "&8Brewed potions last &a%percent_more%%&8 longer" @@ -86,6 +96,8 @@ potionmaster: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] shamanism: description: "&8Heal &a%percent_faster%%&8 faster" @@ -94,6 +106,8 @@ shamanism: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] craftsmanship: description: "&8Axes take &a%percent_less%%&8 less durability damage" @@ -102,6 +116,8 @@ craftsmanship: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] second_chance: description: "&8Items have a &a%chance%%&8 chance to instantly repair below &a30&8 durability" @@ -114,6 +130,8 @@ second_chance: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] efficient_brewing: description: "&8Potions take &a%seconds_less%&8 less seconds to brew" @@ -122,6 +140,8 @@ efficient_brewing: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] mystic_resilience: description: "&a%chance%%&8 chance to ignore negative potion effects" @@ -130,6 +150,8 @@ mystic_resilience: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] satiation: description: "&8Lose &a%percent_less%%&8 less hunger" @@ -138,6 +160,8 @@ satiation: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] golden_yield: description: "&a%chance%%&8 chance to get &a5x&8 drops" @@ -149,6 +173,8 @@ golden_yield: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] dodging: description: "&a%chance%%&8 chance to ignore incoming damage" @@ -157,6 +183,8 @@ dodging: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] accelerated_escape: description: "&8Run &a%percent_faster%%&8 faster for &a1.5&8 seconds after taking damage" @@ -168,6 +196,8 @@ accelerated_escape: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] infernal_resistance: description: "&a%chance%%&8 chance to ignore fire damage" @@ -176,6 +206,8 @@ infernal_resistance: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] bravery: description: "&8Take &a%percent_less%%&8 less damage from bosses" @@ -184,6 +216,8 @@ bravery: # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] dazzle: description: "&a%chance%%&8 chance to give your opponent nausea for &a%seconds%&8 seconds" @@ -195,6 +229,8 @@ dazzle: chance-per-level: 1.5 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] strong_impact: description: "&a%chance%%&8 chance to deal &a3x&8 damage" @@ -204,6 +240,8 @@ strong_impact: chance-per-level: 0.2 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] endangering: description: "&a%chance%%&8 chance to remove your opponents invulnerability frame" @@ -211,6 +249,8 @@ endangering: chance-per-level: 3 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] spelunking: description: "&a%chance%%&8 chance to get &a%multiplier%x&8 drops from ores" @@ -240,6 +280,8 @@ spelunking: chance-per-level: 8 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] dynamic_mining: description: "&a%chance%%&8 chance to get Haste III for &a%seconds%&8 seconds when breaking blocks" @@ -253,6 +295,8 @@ dynamic_mining: level: 3 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] reimbursement: description: "&a%chance%%&8 chance to get experience back after enchanting" @@ -260,6 +304,8 @@ reimbursement: chance-per-level: 0.5 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] overcompensation: description: "&a%chance%%&8 chance to get lapis back after enchanting" @@ -267,6 +313,8 @@ overcompensation: chance-per-level: 0.75 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] master_lumberjack: description: "&a%chance%%&8 chance to get &a%multiplier%x&8 drops from trees" @@ -293,6 +341,8 @@ master_lumberjack: chance-per-level: 6 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ] magnetic_rod: description: "&8Increases fishing speed by &a%percentage%%" @@ -300,3 +350,5 @@ magnetic_rod: speed-per-level: 5 # Disabled worlds disabled-in-worlds: [ ] + # Conditions + conditions: [ ]