mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Add new clear pipeline to hpw and make some stuff read access as required.
This commit is contained in:
parent
580212d66d
commit
ad1ec42b12
3 changed files with 15 additions and 4 deletions
|
@ -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 {
|
|||
* </p>
|
||||
*/
|
||||
@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();
|
||||
|
|
|
@ -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<Integer, BiomeType> 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(),
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue