mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Address deprecations in queue/generation code
This commit is contained in:
parent
3d87ee41b3
commit
43150abb86
@ -31,7 +31,7 @@ import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
@ -65,7 +65,7 @@ final class BlockStatePopulator extends BlockPopulator {
|
||||
return;
|
||||
}
|
||||
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
||||
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z,
|
||||
final ZeroedDelegateScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z,
|
||||
com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(world),
|
||||
com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(world) - 1
|
||||
);
|
||||
|
@ -35,7 +35,7 @@ import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import org.bukkit.World;
|
||||
@ -198,7 +198,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return result.getChunkData();
|
||||
}
|
||||
|
||||
private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
|
||||
private void generate(BlockVector2 loc, World world, ZeroedDelegateScopedQueueCoordinator result) {
|
||||
// Load if improperly loaded
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
|
@ -31,7 +31,7 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import org.bukkit.World;
|
||||
@ -67,7 +67,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
||||
public void generateChunk(final ZeroedDelegateScopedQueueCoordinator result, PlotArea settings) {
|
||||
World world = BukkitUtil.getWorld(this.world);
|
||||
Location min = result.getMin();
|
||||
int chunkX = min.getX() >> 4;
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.bukkit.util.BukkitBlockUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.AnnotationHelper;
|
||||
import com.plotsquared.core.util.ChunkUtil;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
@ -52,7 +52,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import java.util.Arrays;
|
||||
|
||||
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
|
||||
public class GenChunk extends ScopedQueueCoordinator {
|
||||
public class GenChunk extends ZeroedDelegateScopedQueueCoordinator {
|
||||
|
||||
public final Biome[] biomes;
|
||||
public BlockState[][] result;
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.RegionManager;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
@ -264,9 +264,9 @@ public class BukkitRegionManager extends RegionManager {
|
||||
map.saveEntitiesOut(Bukkit.getWorld(world.getName()).getChunkAt(x, z), currentPlotClear);
|
||||
AugmentedUtils.bypass(
|
||||
ignoreAugment,
|
||||
() -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<ScopedQueueCoordinator>() {
|
||||
() -> ChunkManager.setChunkInPlotArea(null, new RunnableVal<ZeroedDelegateScopedQueueCoordinator>() {
|
||||
@Override
|
||||
public void run(ScopedQueueCoordinator value) {
|
||||
public void run(ZeroedDelegateScopedQueueCoordinator value) {
|
||||
Location min = value.getMin();
|
||||
int bx = min.getX();
|
||||
int bz = min.getZ();
|
||||
|
@ -430,8 +430,7 @@ public class Area extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("setup.setup_finished"));
|
||||
if (area.getTerrain() != PlotAreaTerrainType.ALL) {
|
||||
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
|
||||
queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
|
||||
null,
|
||||
queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
|
||||
world,
|
||||
chunk.getX(),
|
||||
chunk.getZ(),
|
||||
@ -803,8 +802,7 @@ public class Area extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
|
||||
queue.setChunkConsumer(chunk -> AugmentedUtils.generate(
|
||||
null,
|
||||
queue.setChunkConsumer(chunk -> AugmentedUtils.generateChunk(
|
||||
area.getWorldName(),
|
||||
chunk.getX(),
|
||||
chunk.getZ(),
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.queue.AreaBoundDelegateQueueCoordinator;
|
||||
import com.plotsquared.core.queue.LocationOffsetDelegateQueueCoordinator;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.RegionUtil;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -168,8 +168,8 @@ public class AugmentedUtils {
|
||||
|
||||
// This queue should not be enqueued as it is simply used to restrict block setting, and then delegate to the
|
||||
// actual queue
|
||||
ScopedQueueCoordinator scoped =
|
||||
new ScopedQueueCoordinator(
|
||||
ZeroedDelegateScopedQueueCoordinator scoped =
|
||||
new ZeroedDelegateScopedQueueCoordinator(
|
||||
secondaryMask,
|
||||
Location.at(world, blockX, area.getMinGenHeight(), blockZ),
|
||||
Location.at(world, blockX + 15, area.getMaxGenHeight(), blockZ + 15)
|
||||
@ -183,19 +183,4 @@ public class AugmentedUtils {
|
||||
return generationResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link AugmentedUtils#generateChunk(String, int, int, QueueCoordinator)} as chunkObject is not required
|
||||
* in the above method
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||
public static boolean generate(
|
||||
@Nullable Object chunkObject,
|
||||
final @NonNull String world,
|
||||
final int chunkX,
|
||||
final int chunkZ,
|
||||
QueueCoordinator queue
|
||||
) {
|
||||
return generateChunk(world, chunkX, chunkZ, queue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -55,12 +55,16 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
private void placeSchem(
|
||||
HybridPlotWorld world, ScopedQueueCoordinator result, short relativeX,
|
||||
short relativeZ, int x, int z, boolean isRoad
|
||||
HybridPlotWorld world,
|
||||
ZeroedDelegateScopedQueueCoordinator result,
|
||||
short relativeX,
|
||||
short relativeZ,
|
||||
int x,
|
||||
int z,
|
||||
boolean isRoad
|
||||
) {
|
||||
int minY; // Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT);
|
||||
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad
|
||||
&& Settings.Schematics.PASTE_ON_TOP)) {
|
||||
if ((isRoad && Settings.Schematics.PASTE_ROAD_ON_TOP) || (!isRoad && Settings.Schematics.PASTE_ON_TOP)) {
|
||||
minY = world.SCHEM_Y;
|
||||
} else {
|
||||
minY = world.getMinBuildHeight();
|
||||
@ -80,7 +84,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(@NonNull ScopedQueueCoordinator result, @NonNull PlotArea settings) {
|
||||
public void generateChunk(@NonNull ZeroedDelegateScopedQueueCoordinator result, @NonNull PlotArea settings) {
|
||||
Preconditions.checkNotNull(result, "result cannot be null");
|
||||
Preconditions.checkNotNull(settings, "settings cannot be null");
|
||||
|
||||
|
@ -594,20 +594,6 @@ public class HybridUtils {
|
||||
return ey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the road in a chunk in a plot area.
|
||||
*
|
||||
* @param area Plot area to regenerate road for
|
||||
* @param chunk Chunk location to regenerate
|
||||
* @param extend How far to extend setting air above the road
|
||||
* @return if successful
|
||||
* @deprecated use {@link HybridUtils#regenerateRoad(PlotArea, BlockVector2, int, QueueCoordinator)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.6.0")
|
||||
public boolean regenerateRoad(final PlotArea area, final BlockVector2 chunk, int extend) {
|
||||
return regenerateRoad(area, chunk, extend, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the road in a chunk in a plot area.
|
||||
*
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.generator;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
@ -54,9 +54,9 @@ public abstract class IndependentPlotGenerator {
|
||||
* @param result queue
|
||||
* @param settings PlotArea (settings)
|
||||
*/
|
||||
public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
|
||||
public abstract void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings);
|
||||
|
||||
public boolean populateChunk(ScopedQueueCoordinator result, PlotArea setting) {
|
||||
public boolean populateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea setting) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@ -59,7 +59,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(ScopedQueueCoordinator result, PlotArea settings) {
|
||||
public void generateChunk(ZeroedDelegateScopedQueueCoordinator result, PlotArea settings) {
|
||||
SinglePlotArea area = (SinglePlotArea) settings;
|
||||
if (area.VOID) {
|
||||
Location min = result.getMin();
|
||||
|
@ -45,7 +45,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* {@link BlockArrayCacheScopedQueueCoordinator#setOffsetZ(int)}
|
||||
*/
|
||||
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to change at any time and created for specific use cases.")
|
||||
public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinator {
|
||||
public class BlockArrayCacheScopedQueueCoordinator extends ZeroedDelegateScopedQueueCoordinator {
|
||||
|
||||
private final BlockState[][][] blockStates;
|
||||
private final int height;
|
||||
|
@ -1,170 +0,0 @@
|
||||
/*
|
||||
* _____ _ _ _____ _
|
||||
* | __ \| | | | / ____| | |
|
||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||
* | |
|
||||
* |_|
|
||||
* PlotSquared plot management system for Minecraft
|
||||
* Copyright (C) 2014 - 2022 IntellectualSites
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.queue;
|
||||
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Queue that is limited to a single chunk. It does not allow a delegate queue and should be treated as a cache for changes to
|
||||
* be set to. Does not support tile entities or entities.
|
||||
*
|
||||
* @deprecated This class is poorly designed and will no longer be used in P2
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||
public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
|
||||
|
||||
public final BiomeType[][][] biomeResult;
|
||||
public final BlockState[][][] result;
|
||||
private final int width;
|
||||
private final int length;
|
||||
private final BlockVector3 bot;
|
||||
private final BlockVector3 top;
|
||||
private final World weWorld;
|
||||
|
||||
public ChunkQueueCoordinator(
|
||||
final @NonNull World weWorld,
|
||||
@NonNull BlockVector3 bot,
|
||||
@NonNull BlockVector3 top,
|
||||
boolean biomes
|
||||
) {
|
||||
super(null, Location.at("", 0, weWorld.getMinY(), 0), Location.at("", 15, weWorld.getMaxY(), 15));
|
||||
this.weWorld = weWorld;
|
||||
this.width = top.getX() - bot.getX() + 1;
|
||||
this.length = top.getZ() - bot.getZ() + 1;
|
||||
this.result = new BlockState[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length];
|
||||
this.biomeResult = biomes ? new BiomeType[weWorld.getMaxY() - weWorld.getMinY() + 1][width][length] : null;
|
||||
this.bot = bot;
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public @NonNull BlockState[][][] getBlocks() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
|
||||
if (this.biomeResult != null) {
|
||||
for (int y = weWorld.getMinY(); y <= weWorld.getMaxY(); y++) {
|
||||
this.storeCacheBiome(x, y, z, biomeType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
|
||||
if (this.biomeResult != null) {
|
||||
this.storeCacheBiome(x, y, z, biomeType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, @NonNull BlockState id) {
|
||||
this.storeCache(x, y, z, id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
|
||||
this.storeCache(x, y, z, pattern.applyBlock(BlockVector3.at(x, y, z)).toImmutableState());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void storeCache(final int x, final int y, final int z, final @NonNull BlockState id) {
|
||||
int yIndex = getYIndex(y);
|
||||
BlockState[][] resultY = result[yIndex];
|
||||
if (resultY == null) {
|
||||
result[yIndex] = resultY = new BlockState[length][];
|
||||
}
|
||||
BlockState[] resultYZ = resultY[z];
|
||||
if (resultYZ == null) {
|
||||
resultY[z] = resultYZ = new BlockState[width];
|
||||
}
|
||||
resultYZ[x] = id;
|
||||
}
|
||||
|
||||
private void storeCacheBiome(final int x, final int y, final int z, final @NonNull BiomeType id) {
|
||||
int yIndex = getYIndex(y);
|
||||
BiomeType[][] resultY = biomeResult[yIndex];
|
||||
if (resultY == null) {
|
||||
biomeResult[yIndex] = resultY = new BiomeType[length][];
|
||||
}
|
||||
BiomeType[] resultYZ = resultY[z];
|
||||
if (resultYZ == null) {
|
||||
resultY[z] = resultYZ = new BiomeType[width];
|
||||
}
|
||||
resultYZ[x] = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, final @NonNull BaseBlock id) {
|
||||
this.storeCache(x, y, z, id.toImmutableState());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BlockState getBlock(int x, int y, int z) {
|
||||
BlockState[][] blocksY = result[getYIndex(y)];
|
||||
if (blocksY != null) {
|
||||
BlockState[] blocksYZ = blocksY[z];
|
||||
if (blocksYZ != null) {
|
||||
return blocksYZ[x];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable World getWorld() {
|
||||
return weWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Location getMax() {
|
||||
return Location.at(getWorld().getName(), top.getX(), top.getY(), top.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Location getMin() {
|
||||
return Location.at(getWorld().getName(), bot.getX(), bot.getY(), bot.getZ());
|
||||
}
|
||||
|
||||
private int getYIndex(int y) {
|
||||
return y - weWorld.getMinY();
|
||||
}
|
||||
|
||||
}
|
@ -71,15 +71,15 @@ public abstract class QueueCoordinator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
||||
* Get a {@link ZeroedDelegateScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
||||
*
|
||||
* @param x chunk x coordinate
|
||||
* @param z chunk z coordinate
|
||||
* @return a new {@link ScopedQueueCoordinator}
|
||||
* @deprecated Use {@link ScopedQueueCoordinator#getForChunk(int, int, int, int)}
|
||||
* @return a new {@link ZeroedDelegateScopedQueueCoordinator}
|
||||
* @deprecated Use {@link ZeroedDelegateScopedQueueCoordinator#getForChunk(int, int, int, int)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.6.0")
|
||||
public ScopedQueueCoordinator getForChunk(int x, int z) {
|
||||
public ZeroedDelegateScopedQueueCoordinator getForChunk(int x, int z) {
|
||||
if (getWorld() == null) {
|
||||
return getForChunk(x, z, PlotSquared.platform().versionMinHeight(), PlotSquared.platform().versionMaxHeight());
|
||||
}
|
||||
@ -87,17 +87,17 @@ public abstract class QueueCoordinator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
||||
* Get a {@link ZeroedDelegateScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
||||
*
|
||||
* @param x chunk x coordinate
|
||||
* @param z chunk z coordinate
|
||||
* @return a new {@link ScopedQueueCoordinator}
|
||||
* @return a new {@link ZeroedDelegateScopedQueueCoordinator}
|
||||
* @since 6.6.0
|
||||
*/
|
||||
public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
|
||||
public ZeroedDelegateScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
|
||||
int bx = x << 4;
|
||||
int bz = z << 4;
|
||||
return new ScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
|
||||
return new ZeroedDelegateScopedQueueCoordinator(this, Location.at(getWorld().getName(), bx, minY, bz),
|
||||
Location.at(getWorld().getName(), bx + 15, maxY, bz + 15)
|
||||
);
|
||||
}
|
||||
|
@ -35,13 +35,11 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized in
|
||||
* the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to x and z.
|
||||
*
|
||||
* @deprecated This should be renamed to NormalizedScopedQueueCoordinator or something.
|
||||
* Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized to
|
||||
* zero in the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to
|
||||
* x and z.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||
public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
public class ZeroedDelegateScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
|
||||
private final Location min;
|
||||
private final Location max;
|
||||
@ -57,7 +55,7 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
/**
|
||||
* Create a new ScopedQueueCoordinator instance that delegates to a given QueueCoordinator. Locations are inclusive.
|
||||
*/
|
||||
public ScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
|
||||
public ZeroedDelegateScopedQueueCoordinator(@Nullable QueueCoordinator parent, @NonNull Location min, @NonNull Location max) {
|
||||
super(parent);
|
||||
this.min = min;
|
||||
this.max = max;
|
@ -28,7 +28,7 @@ package com.plotsquared.core.util;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||
import com.plotsquared.core.queue.ZeroedDelegateScopedQueueCoordinator;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -39,12 +39,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public abstract class ChunkManager {
|
||||
|
||||
private static final Map<BlockVector2, RunnableVal<ScopedQueueCoordinator>> forceChunks = new ConcurrentHashMap<>();
|
||||
private static final Map<BlockVector2, RunnableVal<ScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();
|
||||
private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> forceChunks = new ConcurrentHashMap<>();
|
||||
private static final Map<BlockVector2, RunnableVal<ZeroedDelegateScopedQueueCoordinator>> addChunks = new ConcurrentHashMap<>();
|
||||
|
||||
public static void setChunkInPlotArea(
|
||||
RunnableVal<ScopedQueueCoordinator> force,
|
||||
RunnableVal<ScopedQueueCoordinator> add,
|
||||
RunnableVal<ZeroedDelegateScopedQueueCoordinator> force,
|
||||
RunnableVal<ZeroedDelegateScopedQueueCoordinator> add,
|
||||
String world,
|
||||
BlockVector2 loc
|
||||
) {
|
||||
@ -53,8 +53,8 @@ public abstract class ChunkManager {
|
||||
if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get().isNonStandardGeneration(world, loc)) {
|
||||
int blockX = loc.getX() << 4;
|
||||
int blockZ = loc.getZ() << 4;
|
||||
ScopedQueueCoordinator scoped =
|
||||
new ScopedQueueCoordinator(
|
||||
ZeroedDelegateScopedQueueCoordinator scoped =
|
||||
new ZeroedDelegateScopedQueueCoordinator(
|
||||
queue,
|
||||
Location.at(world, blockX, weWorld.getMinY(), blockZ),
|
||||
Location.at(world, blockX + 15, weWorld.getMaxY(), blockZ + 15)
|
||||
@ -79,8 +79,8 @@ public abstract class ChunkManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean preProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
|
||||
final RunnableVal<ScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
|
||||
public static boolean preProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
|
||||
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
|
||||
if (forceChunk != null) {
|
||||
forceChunk.run(queue);
|
||||
forceChunks.remove(loc);
|
||||
@ -89,8 +89,8 @@ public abstract class ChunkManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean postProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
|
||||
final RunnableVal<ScopedQueueCoordinator> addChunk = forceChunks.get(loc);
|
||||
public static boolean postProcessChunk(BlockVector2 loc, ZeroedDelegateScopedQueueCoordinator queue) {
|
||||
final RunnableVal<ZeroedDelegateScopedQueueCoordinator> addChunk = forceChunks.get(loc);
|
||||
if (addChunk != null) {
|
||||
addChunk.run(queue);
|
||||
addChunks.remove(loc);
|
||||
|
Loading…
Reference in New Issue
Block a user