Search in sources :

Example 6 with EffectPlayer

use of com.elmakers.mine.bukkit.api.effect.EffectPlayer in project MagicPlugin by elBukkit.

the class CustomProjectileAction method startProjectileEffects.

protected void startProjectileEffects(CastContext context, String effectKey) {
    Collection<EffectPlayer> projectileEffects = context.getEffects(effectKey);
    for (EffectPlayer apiEffectPlayer : projectileEffects) {
        if (effectLocation == null) {
            effectLocation = new DynamicLocation(actionContext.getTargetLocation());
            effectLocation.setDirection(velocity);
        }
        if (activeProjectileEffects == null) {
            activeProjectileEffects = new ArrayList<>();
        }
        // Hrm- this is ugly, but I don't want the API to depend on EffectLib.
        if (apiEffectPlayer instanceof com.elmakers.mine.bukkit.effect.EffectPlayer) {
            com.elmakers.mine.bukkit.effect.EffectPlayer effectPlayer = (com.elmakers.mine.bukkit.effect.EffectPlayer) apiEffectPlayer;
            effectPlayer.setEffectPlayList(activeProjectileEffects);
            effectPlayer.startEffects(effectLocation, null);
        }
    }
}
Also used : EffectPlayer(com.elmakers.mine.bukkit.api.effect.EffectPlayer) DynamicLocation(de.slikey.effectlib.util.DynamicLocation)

Aggregations

EffectPlayer (com.elmakers.mine.bukkit.api.effect.EffectPlayer)6 Location (org.bukkit.Location)3 Entity (org.bukkit.entity.Entity)3 LivingEntity (org.bukkit.entity.LivingEntity)2 Projectile (org.bukkit.entity.Projectile)2 Vector (org.bukkit.util.Vector)2 Mage (com.elmakers.mine.bukkit.api.magic.Mage)1 MageController (com.elmakers.mine.bukkit.api.magic.MageController)1 DynamicLocation (de.slikey.effectlib.util.DynamicLocation)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Block (org.bukkit.block.Block)1 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)1 AreaEffectCloud (org.bukkit.entity.AreaEffectCloud)1 Arrow (org.bukkit.entity.Arrow)1 Fireball (org.bukkit.entity.Fireball)1 FixedMetadataValue (org.bukkit.metadata.FixedMetadataValue)1 PotionEffect (org.bukkit.potion.PotionEffect)1