diff --git a/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShoot.kt b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShoot.kt index 93bd7fa56..26ee762aa 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShoot.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShoot.kt @@ -38,7 +38,7 @@ object EffectShoot : Effect("shoot") { player.launchProjectile(projectileClass as Class, velocity) } - if (config.getBool("launch-at-location") && data.location != null) { + if (config.getBool("launch-at-location") && data.location != null && projectile !is AbstractArrow) { projectile.teleportAsync(data.location) } diff --git a/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShootArrow.kt b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShootArrow.kt index 3cb4d89da..83069235c 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShootArrow.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectShootArrow.kt @@ -4,11 +4,16 @@ import com.willfp.eco.core.config.interfaces.Config import com.willfp.eco.util.runExempted import com.willfp.libreforge.NoCompileData import com.willfp.libreforge.effects.Effect +import com.willfp.libreforge.getDoubleFromExpression +import com.willfp.libreforge.getIntFromExpression +import com.willfp.libreforge.getOrNull import com.willfp.libreforge.triggers.TriggerData import com.willfp.libreforge.triggers.TriggerParameter import org.bukkit.entity.AbstractArrow import org.bukkit.entity.Arrow import org.bukkit.event.entity.EntityShootBowEvent +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType object EffectShootArrow : Effect("shoot_arrow") { override val parameters = setOf( @@ -27,8 +32,9 @@ object EffectShootArrow : Effect("shoot_arrow") { player.launchProjectile(Arrow::class.java, velocity) } - if (config.getBool("launch-at-location") && data.location != null) { - arrow.teleportAsync(data.location) + val damage = config.getOrNull("arrow_damage") { getDoubleFromExpression(it, data) } + if (damage != null) { + arrow.damage = damage } arrow.pickupStatus = AbstractArrow.PickupStatus.DISALLOWED @@ -39,6 +45,20 @@ object EffectShootArrow : Effect("shoot_arrow") { if (config.getBool("no_source")) { arrow.shooter = null } + + if (config.getStringOrNull("effect") != null) { + arrow.addCustomEffect( + PotionEffect( + PotionEffectType.getByName(config.getString("effect").uppercase()) + ?: PotionEffectType.INCREASE_DAMAGE, + config.getIntFromExpression("duration", data), + config.getIntFromExpression("level", data) - 1, + true, + true, + true + ), false + ) + } } return true