package com.elmakers.mine.bukkit.action;

import com.elmakers.mine.bukkit.api.action.CastContext;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;

public abstract class BaseTeleportAction extends BaseSpellAction
{
    protected int verticalSearchDistance;
    protected boolean safe = true;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        verticalSearchDistance = parameters.getInt("vertical_range", context.getVerticalSearchDistance());
        safe = parameters.getBoolean("safe", true);
    }

    protected void teleport(CastContext context, Entity entity, Location targetLocation) {
        context.teleport(entity, targetLocation, verticalSearchDistance, safe);
    }
}

@@ -91,16 +91,71 @@
 ontext;%0A
+import com.elmakers.mine.bukkit.api.spell.SpellResult;%0A
 import o
@@ -405,16 +405,69 @@
  = true;
+%0A    private boolean requiresBuildPermission = false;
 %0A%0A    @O
@@ -753,24 +753,105 @@
 fe%22, true);%0A
+        requiresBuildPermission = parameters.getBoolean(%22require_build%22, false);%0A
     %7D%0A%0A    p
@@ -859,20 +859,27 @@
 otected 
-void
+SpellResult
  telepor
@@ -951,16 +951,186 @@
         
+if (requiresBuildPermission && !context.hasBuildPermission(targetLocation.getBlock())) %7B%0A            return SpellResult.INSUFFICIENT_PERMISSION;%0A        %7D%0A        return 
 context.
@@ -1191,16 +1191,54 @@
 e, safe)
+ ? SpellResult.CAST : SpellResult.FAIL
 ;%0A    %7D%0A

Add require_build parameter to teleport actions