Start switching to WorldEdit Worlds

This commit is contained in:
dordsor21
2020-07-17 17:21:32 +01:00
parent 74c6fc954e
commit 66b94ab9f1
11 changed files with 29 additions and 33 deletions

View File

@ -190,7 +190,7 @@ public class Trim extends SubCommand {
}
}
}
final QueueCoordinator queue = blockQueue.getNewQueue(world, false);
final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world), false);
TaskManager.getPlatformImplementation().objectTask(chunks, new RunnableVal<BlockVector2>() {
@Override public void run(BlockVector2 value) {
queue.regenChunk(value.getX(), value.getZ());

View File

@ -87,7 +87,7 @@ public class AugmentedUtils {
IndependentPlotGenerator generator = area.getGenerator();
// Mask
if (queue == null) {
queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(world, false);
queue = PlotSquared.platform().getGlobalBlockQueue().getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(world), false);
queue.setChunkObject(chunkObject);
}
QueueCoordinator primaryMask;

View File

@ -128,7 +128,7 @@ public class HybridUtils {
*
*/
TaskManager.runTaskAsync(() -> {
final QueueCoordinator queue = blockQueue.getNewQueue(world, false);
final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world), false);
final BlockVector3 bot = region.getMinimumPoint();
final BlockVector3 top = region.getMaximumPoint();
@ -520,7 +520,7 @@ public class HybridUtils {
public boolean setupRoadSchematic(Plot plot) {
final String world = plot.getWorldName();
final QueueCoordinator queue = blockQueue.getNewQueue(world, false);
final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world), false);
Location bot = plot.getBottomAbs().subtract(1, 0, 1);
Location top = plot.getTopAbs();
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
@ -607,7 +607,7 @@ public class HybridUtils {
z -= plotWorld.ROAD_OFFSET_Z;
final int finalX = x;
final int finalZ = z;
QueueCoordinator queue = this.blockQueue.getNewQueue(plotWorld.getWorldName(), false);
QueueCoordinator queue = this.blockQueue.getNewQueue(worldUtil.getWeWorld(plotWorld.getWorldName()), false);
if (id1 == null || id2 == null || id1 != id2) {
this.chunkManager.loadChunk(area.getWorldName(), chunk, false).thenRun(() -> {
if (id1 != null) {

View File

@ -1687,7 +1687,7 @@ public class Plot {
* This should not need to be called
*/
public void refreshChunks() {
QueueCoordinator queue = this.blockQueue.getNewQueue(getWorldName(), false);
QueueCoordinator queue = this.blockQueue.getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(getWorldName()), false);
HashSet<BlockVector2> chunks = new HashSet<>();
for (CuboidRegion region : Plot.this.getRegions()) {
for (int x = region.getMinimumPoint().getX() >> 4;

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.plot;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.collection.QuadMap;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
@ -172,7 +173,7 @@ public abstract class PlotArea {
@Nonnull protected abstract PlotManager createManager();
public QueueCoordinator getQueue(final boolean autoQueue) {
return this.globalBlockQueue.getNewQueue(worldName, autoQueue);
return this.globalBlockQueue.getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(worldName), autoQueue);
}
/**

View File

@ -26,13 +26,9 @@
package com.plotsquared.core.queue;
import com.plotsquared.core.PlotSquared;
<<<<<<< HEAD
import com.sk89q.worldedit.world.World;
import lombok.Getter;
import lombok.Setter;
=======
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
import java.util.ArrayList;
import java.util.List;
@ -48,7 +44,7 @@ public class GlobalBlockQueue {
this.activeQueues = new ConcurrentLinkedDeque<>();
}
public QueueCoordinator getNewQueue(String world, boolean autoQueue) {
public QueueCoordinator getNewQueue(World world, boolean autoQueue) {
QueueCoordinator queue = provider.getNewQueue(world);
// Auto-inject into the queue
PlotSquared.platform().getInjector().injectMembers(queue);

View File

@ -25,6 +25,8 @@
*/
package com.plotsquared.core.queue;
import com.sk89q.worldedit.world.World;
public abstract class QueueProvider {
public static QueueProvider of(final Class<? extends QueueCoordinator> primary,
final Class<? extends QueueCoordinator> fallback) {
@ -32,7 +34,7 @@ public abstract class QueueProvider {
private boolean failed = false;
@Override public QueueCoordinator getNewQueue(String world) {
@Override public QueueCoordinator getNewQueue(World world) {
if (!failed) {
try {
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
@ -51,5 +53,5 @@ public abstract class QueueProvider {
};
}
public abstract QueueCoordinator getNewQueue(String world);
public abstract QueueCoordinator getNewQueue(World world);
}

View File

@ -51,7 +51,7 @@ public abstract class ChunkManager {
public static void setChunkInPlotArea(RunnableVal<ScopedQueueCoordinator> force,
RunnableVal<ScopedQueueCoordinator> add, String world, BlockVector2 loc) {
QueueCoordinator queue =
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(world, false);
PlotSquared.platform().getGlobalBlockQueue().getNewQueue(PlotSquared.platform().getWorldUtil().getWeWorld(world), false);
if (PlotSquared.get().getPlotAreaManager().isAugmented(world) && PlotSquared.get()
.isNonStandardGeneration(world, loc)) {
int blockX = loc.getX() << 4;

View File

@ -55,7 +55,7 @@ public abstract class RegionManager {
public static RegionManager manager = null;
private final ChunkManager chunkManager;
public RegionManager(@Nonnull final ChunkManager chunkManager) {
public RegionManager(@Nonnull final ChunkManager chunkManager, @Nonnull WorldUtil worldUtil) {
this.chunkManager = chunkManager;
}