package com.elmakers.mine.bukkit.spell.builtin;

import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.api.block.MaterialBrush;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import com.elmakers.mine.bukkit.spell.BrushSpell;
import com.elmakers.mine.bukkit.utility.Target;

public class PlaceSpell extends BrushSpell 
{
	@Override
	public SpellResult onCast(ConfigurationSection parameters) 
	{
		Target attachToBlock = getTarget();
		if (!attachToBlock.isValid()) return SpellResult.NO_TARGET;
		Block placeBlock = getPreviousBlock();

		MaterialBrush buildWith = getBrush();
		buildWith.setTarget(attachToBlock.getLocation(), placeBlock.getLocation());

		if (!hasBuildPermission(placeBlock)) {
			return SpellResult.INSUFFICIENT_PERMISSION;
		}
		registerForUndo(placeBlock);
		buildWith.modify(placeBlock);

		registerForUndo();

		return SpellResult.CAST;
	}
}

@@ -604,16 +604,116 @@
 k();%0A%0A%09%09
+if (!hasBuildPermission(placeBlock)) %7B%0A%09%09%09return SpellResult.INSUFFICIENT_PERMISSION;%0A%09%09%7D%0A%0A%0A        
 Material
@@ -742,18 +742,24 @@
 rush();%0A
-%09%09
+        
 buildWit
@@ -830,100 +830,66 @@
 ));%0A
-%0A%09%09if (!hasBuildPermission(placeBlock)) %7B%0A%09%09%09return SpellResult.INSUFFICIENT_PERMISSION;%0A%09%09%7D
+        buildWith.update(mage, placeBlock.getLocation());%0A
 %0A%09%09r

Fix Place + replicate