Search in sources :

Example 1 with BlockList

use of com.elmakers.mine.bukkit.api.block.BlockList in project MagicPlugin by elBukkit.

the class TransmuteSpell method onCast.

@Override
public SpellResult onCast(ConfigurationSection parameters) {
    BlockList transmuteAction = null;
    /*
         * Use target if targeting
         */
    Block target = getTargetBlock();
    if (target != null) {
        UndoQueue undoQueue = mage.getUndoQueue();
        transmuteAction = undoQueue.getLast(target);
    }
    if (transmuteAction == null) {
        UndoQueue undoQueue = mage.getUndoQueue();
        transmuteAction = undoQueue.getLast();
    }
    if (transmuteAction == null) {
        return SpellResult.NO_TARGET;
    }
    MaterialBrush buildWith = getBrush();
    for (BlockData undoBlock : transmuteAction) {
        Block block = undoBlock.getBlock();
        buildWith.modify(block);
    }
    return SpellResult.CAST;
}
Also used : UndoQueue(com.elmakers.mine.bukkit.api.block.UndoQueue) MaterialBrush(com.elmakers.mine.bukkit.api.block.MaterialBrush) BlockList(com.elmakers.mine.bukkit.api.block.BlockList) Block(org.bukkit.block.Block) BlockData(com.elmakers.mine.bukkit.api.block.BlockData)

Aggregations

BlockData (com.elmakers.mine.bukkit.api.block.BlockData)1 BlockList (com.elmakers.mine.bukkit.api.block.BlockList)1 MaterialBrush (com.elmakers.mine.bukkit.api.block.MaterialBrush)1 UndoQueue (com.elmakers.mine.bukkit.api.block.UndoQueue)1 Block (org.bukkit.block.Block)1