Search in sources :

Example 1 with FlowerAction

use of com.elmakers.mine.bukkit.action.builtin.FlowerAction 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)1 CoverAction (com.elmakers.mine.bukkit.action.builtin.CoverAction)1 FlowerAction (com.elmakers.mine.bukkit.action.builtin.FlowerAction)1 Target (com.elmakers.mine.bukkit.utility.Target)1 Block (org.bukkit.block.Block)1