mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Make sure augmented generation doesn't crash the server
This commit is contained in:
@ -147,7 +147,7 @@ public class Area extends SubCommand {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils.generate(world, value.getX(),
|
||||
AugmentedUtils.generate(null, world, value.getX(),
|
||||
value.getZ(), null);
|
||||
}
|
||||
}, null);
|
||||
@ -445,7 +445,7 @@ public class Area extends SubCommand {
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
AugmentedUtils
|
||||
.generate(area.getWorldName(), value.getX(), value.getZ(), null);
|
||||
.generate(null, area.getWorldName(), value.getX(), value.getZ(), null);
|
||||
}
|
||||
}, () -> player.sendMessage("Regen complete"));
|
||||
return true;
|
||||
|
@ -16,6 +16,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -29,7 +30,7 @@ public class AugmentedUtils {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public static boolean generate(@NotNull final String world, final int chunkX, final int chunkZ,
|
||||
public static boolean generate(@Nullable Object chunkObject, @NotNull final String world, final int chunkX, final int chunkZ,
|
||||
LocalBlockQueue queue) {
|
||||
if (!enabled) {
|
||||
return false;
|
||||
@ -54,6 +55,7 @@ public class AugmentedUtils {
|
||||
// Mask
|
||||
if (queue == null) {
|
||||
queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||
queue.setChunkObject(chunkObject);
|
||||
}
|
||||
LocalBlockQueue primaryMask;
|
||||
// coordinates
|
||||
@ -102,7 +104,7 @@ public class AugmentedUtils {
|
||||
for (int y = 1; y < 128; y++) {
|
||||
queue.setBlock(rx, y, rz, air);
|
||||
}
|
||||
canPlace[x][z] = can;
|
||||
canPlace[x][z] = true;
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
@ -134,6 +136,11 @@ public class AugmentedUtils {
|
||||
}
|
||||
toReturn = true;
|
||||
}
|
||||
primaryMask.setChunkObject(chunkObject);
|
||||
primaryMask.setForceSync(true);
|
||||
secondaryMask.setChunkObject(chunkObject);
|
||||
secondaryMask.setForceSync(true);
|
||||
|
||||
ScopedLocalBlockQueue scoped = new ScopedLocalBlockQueue(secondaryMask,
|
||||
new Location(area.getWorldName(), blockX, 0, blockZ),
|
||||
new Location(area.getWorldName(), blockX + 15, 255, blockZ + 15));
|
||||
@ -141,6 +148,7 @@ public class AugmentedUtils {
|
||||
generator.populateChunk(scoped, area);
|
||||
}
|
||||
if (queue != null) {
|
||||
queue.setForceSync(true);
|
||||
queue.flush();
|
||||
}
|
||||
return toReturn;
|
||||
|
@ -222,6 +222,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
|
||||
public class BasicLocalChunk extends LocalChunk {
|
||||
|
||||
public BasicLocalChunk(BasicLocalBlockQueue parent, int x, int z) {
|
||||
super(parent, x, z);
|
||||
baseblocks = new BaseBlock[16][];
|
||||
|
@ -13,12 +13,18 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class LocalBlockQueue {
|
||||
|
||||
@Getter @Setter private boolean forceSync = false;
|
||||
@Getter @Setter @Nullable private Object chunkObject;
|
||||
|
||||
/**
|
||||
* Needed for compatibility with FAWE.
|
||||
*
|
||||
|
Reference in New Issue
Block a user