Search in sources :

Example 1 with LightningAction

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

the class LightningSpell 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 LightningAction());
    ActionHandler handler = new ActionHandler();
    handler.loadAction(cover);
    handler.initialize(this, parameters);
    registerForUndo();
    return handler.start(getCurrentCast(), parameters);
}
Also used : Target(com.elmakers.mine.bukkit.utility.Target) CoverAction(com.elmakers.mine.bukkit.action.builtin.CoverAction) LightningAction(com.elmakers.mine.bukkit.action.builtin.LightningAction) 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 LightningAction (com.elmakers.mine.bukkit.action.builtin.LightningAction)1 Target (com.elmakers.mine.bukkit.utility.Target)1 Block (org.bukkit.block.Block)1