package com.gmail.St3venAU.plugins.ArmorStandTools;

import com.intellectualcrafters.plot.api.PlotAPI;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import org.bukkit.Location;
import org.bukkit.entity.Player;

import java.util.UUID;

class PlotSquaredHook {
    
    public static PlotAPI api = null;
    private static Main plugin;
    
    public PlotSquaredHook(Main main) {
        PlotSquaredHook.api = new PlotAPI();
        plugin = main;
    }
    
    public static boolean isPlotWorld(Location loc) {
        return api.getPlotSquared().hasPlotArea(loc.getWorld().getName());
    }

    public static boolean checkPermission(Player player, Location loc) {
        Plot plot = api.getPlot(loc);
        PlotPlayer pp = PlotPlayer.wrap(player);
        plugin.debug("Plot: " + plot);
        if (plot == null) {
            plugin.debug("plots.admin.build.road: " + pp.hasPermission("plots.admin.build.road"));
            return pp.hasPermission("plots.admin.build.road");
        }
        UUID uuid = pp.getUUID();
        plugin.debug("plot.isAdded: " + plot.isAdded(uuid));
        plugin.debug("plots.admin.build.other: " + pp.hasPermission("plots.admin.build.other"));
        return plot.isAdded(uuid) || pp.hasPermission("plots.admin.build.other");
    }
}

@@ -49,32 +49,39 @@
 ls;%0A%0Aimport com.
+github.
 intellectualcraf
@@ -76,29 +76,33 @@
 llectual
-craf
+si
 te
-r
 s.plot
+squared
 .api.Plo
@@ -110,32 +110,39 @@
 API;%0Aimport com.
+github.
 intellectualcraf
@@ -133,32 +133,113 @@
 intellectual
-crafters
+sites.plotsquared.bukkit.util.BukkitUtil;%0Aimport com.github.intellectualsites.plotsquared
 .plot.object
@@ -256,16 +256,23 @@
 ort com.
+github.
 intellec
@@ -279,16 +279,95 @@
 tual
-crafters
+sites.plotsquared.plot.object.PlotArea;%0Aimport com.github.intellectualsites.plotsquared
 .plo
@@ -535,15 +535,8 @@
  api
- = null
 ;%0A  
@@ -886,32 +886,37 @@
 er, Location loc
+ation
 ) %7B%0A        Plot
@@ -915,23 +915,414 @@
     
-Plot plot = api
+com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = BukkitUtil.getLocation(location);%0A        PlotArea plotArea = plotLocation.getPlotArea();%0A        if(plotArea == null) %7B%0A            plugin.debug(%22plots.admin.build.road: %22 + player.hasPermission(%22plots.admin.build.road%22));%0A            return player.hasPermission(%22plots.admin.build.road%22);%0A        %7D%0A        Plot plot = plotArea
 .get
@@ -1326,19 +1326,28 @@
 getPlot(
+p
 lo
-c
+tLocation
 );%0A     

make work with plotsquared breaking branch