Search in sources :

Example 1 with CoverAction

use of com.elmakers.mine.bukkit.action.builtin.CoverAction 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)

Example 2 with CoverAction

use of com.elmakers.mine.bukkit.action.builtin.CoverAction 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)

Example 3 with CoverAction

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

the class FireSpell 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 BurnAction());
    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) BurnAction(com.elmakers.mine.bukkit.action.builtin.BurnAction) Block(org.bukkit.block.Block) ActionHandler(com.elmakers.mine.bukkit.action.ActionHandler)

Example 4 with CoverAction

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

the class FlowerSpell 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 FlowerAction());
    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) FlowerAction(com.elmakers.mine.bukkit.action.builtin.FlowerAction) Block(org.bukkit.block.Block) ActionHandler(com.elmakers.mine.bukkit.action.ActionHandler)

Aggregations

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