mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Fix partial area regeneration when using PlotSquared generation.
Also fix issues with region height and road width.
This commit is contained in:
parent
6d0458281b
commit
32a55127f1
@ -348,7 +348,7 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
CuboidRegion currentPlotClear = RegionUtil
|
CuboidRegion currentPlotClear = RegionUtil
|
||||||
.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
||||||
map.saveEntitiesOut(chunkObj, currentPlotClear);
|
map.saveEntitiesOut(chunkObj, currentPlotClear);
|
||||||
AugmentedUtils.bypass(ignoreAugment, () -> ChunkManager.manager
|
AugmentedUtils.bypass(ignoreAugment, () -> ChunkManager
|
||||||
.setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
|
.setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
|
||||||
@Override public void run(ScopedLocalBlockQueue value) {
|
@Override public void run(ScopedLocalBlockQueue value) {
|
||||||
Location min = value.getMin();
|
Location min = value.getMin();
|
||||||
|
@ -53,6 +53,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
|||||||
import com.plotsquared.core.plot.BlockBucket;
|
import com.plotsquared.core.plot.BlockBucket;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.PlotAreaTerrainType;
|
||||||
import com.plotsquared.core.plot.PlotAreaType;
|
import com.plotsquared.core.plot.PlotAreaType;
|
||||||
import com.plotsquared.core.plot.PlotCluster;
|
import com.plotsquared.core.plot.PlotCluster;
|
||||||
import com.plotsquared.core.plot.PlotFilter;
|
import com.plotsquared.core.plot.PlotFilter;
|
||||||
@ -90,6 +91,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -270,7 +272,8 @@ public class PlotSquared {
|
|||||||
// create setup util class
|
// create setup util class
|
||||||
SetupUtils.manager = this.IMP.initSetupUtils();
|
SetupUtils.manager = this.IMP.initSetupUtils();
|
||||||
// Set block
|
// Set block
|
||||||
GlobalBlockQueue.IMP = new GlobalBlockQueue(IMP.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME);
|
GlobalBlockQueue.IMP =
|
||||||
|
new GlobalBlockQueue(IMP.initBlockQueue(), 1, Settings.QUEUE.TARGET_TIME);
|
||||||
GlobalBlockQueue.IMP.runTask();
|
GlobalBlockQueue.IMP.runTask();
|
||||||
// Set chunk
|
// Set chunk
|
||||||
ChunkManager.manager = this.IMP.initChunkManager();
|
ChunkManager.manager = this.IMP.initChunkManager();
|
||||||
@ -2014,6 +2017,23 @@ public class PlotSquared {
|
|||||||
return Collections.unmodifiableSet(set);
|
return Collections.unmodifiableSet(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the chunk uses vanilla/non-PlotSquared generation
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @param chunkCoordinates Chunk coordinates
|
||||||
|
* @return True if the chunk uses non-standard generation, false if not
|
||||||
|
*/
|
||||||
|
public boolean isNonStandardGeneration(@NotNull final String world,
|
||||||
|
@NotNull final BlockVector2 chunkCoordinates) {
|
||||||
|
final Location location = new Location(world, chunkCoordinates.getBlockX() << 4, 64, chunkCoordinates.getBlockZ() << 4);
|
||||||
|
final PlotArea area = plotAreaManager.getApplicablePlotArea(location);
|
||||||
|
if (area == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return area.getTerrain() != PlotAreaTerrainType.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAugmented(@NonNull final String world) {
|
public boolean isAugmented(@NonNull final String world) {
|
||||||
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null);
|
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, null);
|
||||||
return areas != null && (areas.length > 1 || areas[0].getType() != PlotAreaType.NORMAL);
|
return areas != null && (areas.length > 1 || areas[0].getType() != PlotAreaType.NORMAL);
|
||||||
|
@ -131,13 +131,15 @@ public class Area extends SubCommand {
|
|||||||
// Plot size is the same as the region width
|
// Plot size is the same as the region width
|
||||||
hybridPlotWorld.PLOT_WIDTH = hybridPlotWorld.SIZE = (short) selectedRegion.getWidth();
|
hybridPlotWorld.PLOT_WIDTH = hybridPlotWorld.SIZE = (short) selectedRegion.getWidth();
|
||||||
// We use a schematic generator
|
// We use a schematic generator
|
||||||
hybridPlotWorld.setTerrain(PlotAreaTerrainType.ALL);
|
hybridPlotWorld.setTerrain(PlotAreaTerrainType.NONE);
|
||||||
// It is always a partial plot world
|
// It is always a partial plot world
|
||||||
hybridPlotWorld.setType(PlotAreaType.PARTIAL);
|
hybridPlotWorld.setType(PlotAreaType.PARTIAL);
|
||||||
// We save the schematic :D
|
// We save the schematic :D
|
||||||
hybridPlotWorld.PLOT_SCHEMATIC = true;
|
hybridPlotWorld.PLOT_SCHEMATIC = true;
|
||||||
// Set the road width to 0
|
// Set the road width to 0
|
||||||
hybridPlotWorld.ROAD_WIDTH = hybridPlotWorld.ROAD_OFFSET_X = hybridPlotWorld.ROAD_OFFSET_Z = 0;
|
hybridPlotWorld.ROAD_WIDTH = hybridPlotWorld.ROAD_OFFSET_X = hybridPlotWorld.ROAD_OFFSET_Z = 0;
|
||||||
|
// Set the plot height to the selection height
|
||||||
|
hybridPlotWorld.PLOT_HEIGHT = hybridPlotWorld.ROAD_HEIGHT = hybridPlotWorld.WALL_HEIGHT = selectedRegion.getHeight();
|
||||||
final File parentFile = MainUtil.getFile(PlotSquared.imp().getDirectory(), "schematics" + File.separator +
|
final File parentFile = MainUtil.getFile(PlotSquared.imp().getDirectory(), "schematics" + File.separator +
|
||||||
"GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator +
|
"GEN_ROAD_SCHEMATIC" + File.separator + hybridPlotWorld.getWorldName() + File.separator +
|
||||||
hybridPlotWorld.getId());
|
hybridPlotWorld.getId());
|
||||||
|
@ -52,7 +52,7 @@ public abstract class ChunkManager {
|
|||||||
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
public static void setChunkInPlotArea(RunnableVal<ScopedLocalBlockQueue> force,
|
||||||
RunnableVal<ScopedLocalBlockQueue> add, String world, BlockVector2 loc) {
|
RunnableVal<ScopedLocalBlockQueue> add, String world, BlockVector2 loc) {
|
||||||
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||||
if (PlotSquared.get().isAugmented(world)) {
|
if (PlotSquared.get().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
|
||||||
int blockX = loc.getX() << 4;
|
int blockX = loc.getX() << 4;
|
||||||
int blockZ = loc.getZ() << 4;
|
int blockZ = loc.getZ() << 4;
|
||||||
ScopedLocalBlockQueue scoped =
|
ScopedLocalBlockQueue scoped =
|
||||||
|
Loading…
Reference in New Issue
Block a user