diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java index 3fd91eb3c..67ad6eb8b 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java @@ -40,12 +40,14 @@ import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.FileBytes; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; +import com.plotsquared.core.util.RegionManager; import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; +import lombok.Getter; import java.io.File; import java.io.IOException; @@ -56,7 +58,7 @@ public class HybridPlotManager extends ClassicPlotManager { public static boolean REGENERATIVE_CLEAR = true; - private final HybridPlotWorld hybridPlotWorld; + @Getter private final HybridPlotWorld hybridPlotWorld; public HybridPlotManager(HybridPlotWorld hybridPlotWorld) { super(hybridPlotWorld); @@ -199,6 +201,12 @@ public class HybridPlotManager extends ClassicPlotManager { *

*/ @Override public boolean clearPlot(Plot plot, final Runnable whenDone) { + if (RegionManager.manager.notifyClear(this)) { + //If this returns false, the clear didn't work + if (RegionManager.manager.handleClear(plot, whenDone, this)) { + return true; + } + } final String world = hybridPlotWorld.getWorldName(); Location pos1 = plot.getBottomAbs(); Location pos2 = plot.getExtendedTopAbs(); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index e322072df..a561a9ac3 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -50,6 +50,7 @@ import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -69,6 +70,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { public HashMap G_SCH_B; public int SCHEM_Y; private Location SIGN_LOCATION; + @Getter private File root = null; public HybridPlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator, PlotId min, PlotId max) { @@ -198,7 +200,6 @@ public class HybridPlotWorld extends ClassicPlotWorld { // Try to determine root. This means that plot areas can have separate schematic // directories - File root; if (!(root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName() + "/" + this.getId())).exists()) { root = MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index 9f6c64696..1349e6c9a 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -169,12 +169,14 @@ public abstract class RegionManager { * * @return true if the notified will accept the clear task */ - public boolean notifyClear() { + public boolean notifyClear(PlotManager manager) { return false; } /** - * Only called when {@link RegionManager#notifyClear()} returns true in specific PlotManagers + * Only called when {@link RegionManager#notifyClear(PlotManager)} returns true in specific PlotManagers + * + * @return true if the clear worked. False if someone went wrong so P2 can then handle the clear */ public abstract boolean handleClear(Plot plot, final Runnable whenDone, PlotManager manager);