Search in sources :

Example 1 with PotionEffectAction

use of com.elmakers.mine.bukkit.action.builtin.PotionEffectAction in project MagicPlugin by elBukkit.

the class FrostSpell method onCast.

@Override
public SpellResult onCast(ConfigurationSection parameters) {
    Target target = getTarget();
    if (target == null || !target.isValid()) {
        return SpellResult.NO_TARGET;
    }
    Block targetBlock = target.getBlock();
    if (!hasBuildPermission(targetBlock)) {
        return SpellResult.INSUFFICIENT_PERMISSION;
    }
    CoverAction cover = new CoverAction();
    cover.addAction(new FreezeAction());
    cover.addAction(new DamageAction());
    cover.addAction(new PotionEffectAction());
    ActionHandler handler = new ActionHandler();
    handler.loadAction(cover);
    handler.initialize(this, parameters);
    registerForUndo();
    return handler.start(getCurrentCast(), parameters);
}
Also used : FreezeAction(com.elmakers.mine.bukkit.action.builtin.FreezeAction) PotionEffectAction(com.elmakers.mine.bukkit.action.builtin.PotionEffectAction) Target(com.elmakers.mine.bukkit.utility.Target) CoverAction(com.elmakers.mine.bukkit.action.builtin.CoverAction) DamageAction(com.elmakers.mine.bukkit.action.builtin.DamageAction) Block(org.bukkit.block.Block) ActionHandler(com.elmakers.mine.bukkit.action.ActionHandler)

Aggregations

ActionHandler (com.elmakers.mine.bukkit.action.ActionHandler)1 CoverAction (com.elmakers.mine.bukkit.action.builtin.CoverAction)1 DamageAction (com.elmakers.mine.bukkit.action.builtin.DamageAction)1 FreezeAction (com.elmakers.mine.bukkit.action.builtin.FreezeAction)1 PotionEffectAction (com.elmakers.mine.bukkit.action.builtin.PotionEffectAction)1 Target (com.elmakers.mine.bukkit.utility.Target)1 Block (org.bukkit.block.Block)1