Add whenDone task to setCuboids and ensure whenDone tasks are added to the queue before FAWE might do something

This commit is contained in:
dordsor21 2021-06-08 19:32:13 +01:00
parent 9bd14b142b
commit f0cbc4f23e
6 changed files with 17 additions and 18 deletions

View File

@ -67,10 +67,10 @@ public class FaweRegionManager extends BukkitRegionManager {
final @NonNull Pattern blocks,
int minY,
int maxY,
@org.checkerframework.checker.nullness.qual.Nullable PlotPlayer<?> actor,
@org.checkerframework.checker.nullness.qual.Nullable QueueCoordinator queue
@Nullable PlotPlayer<?> actor,
@Nullable QueueCoordinator queue
) {
return delegate.setCuboids(area, regions, blocks, minY, maxY);
return delegate.setCuboids(area, regions, blocks, minY, maxY, queue.getCompleteTask());
}
@Override

View File

@ -107,11 +107,7 @@ public class DebugRoadRegen extends SubCommand {
} else {
PlotManager manager = area.getPlotManager();
QueueCoordinator queue = area.getQueue();
manager.createRoadEast(plot, queue);
manager.createRoadSouth(plot, queue);
manager.createRoadSouthEast(plot, queue);
queue.setCompleteTask(() -> {
;
player.sendMessage(
TranslatableCaption.of("debugroadregen.regen_done"),
Template.of("value", plot.getId().toString())
@ -121,6 +117,9 @@ public class DebugRoadRegen extends SubCommand {
Template.of("value", "/plot regenallroads")
);
});
manager.createRoadEast(plot, queue);
manager.createRoadSouth(plot, queue);
manager.createRoadSouthEast(plot, queue);
queue.enqueue();
}
return true;

View File

@ -161,9 +161,6 @@ public class Set extends SubCommand {
BackupManager.backup(player, plot, () -> {
plot.addRunning();
QueueCoordinator queue = plotArea.getQueue();
for (final Plot current : plot.getConnectedPlots()) {
current.getPlotModificationManager().setComponent(component, pattern, player, queue);
}
queue.setCompleteTask(() -> {
plot.removeRunning();
player.sendMessage(
@ -179,6 +176,9 @@ public class Set extends SubCommand {
.getInstance(ProgressSubscriberFactory.class)
.createWithActor(player));
}
for (final Plot current : plot.getConnectedPlots()) {
current.getPlotModificationManager().setComponent(component, pattern, player, queue);
}
queue.enqueue();
player.sendMessage(TranslatableCaption.of("working.generating_component"));
});

View File

@ -222,6 +222,7 @@ public class ComponentPresetManager {
BackupManager.backup(getPlayer(), plot, () -> {
plot.addRunning();
QueueCoordinator queue = plot.getArea().getQueue();
queue.setCompleteTask(plot::removeRunning);
for (Plot current : plot.getConnectedPlots()) {
current.getPlotModificationManager().setComponent(
componentPreset.getComponent().name(),
@ -230,7 +231,6 @@ public class ComponentPresetManager {
queue
);
}
queue.setCompleteTask(plot::removeRunning);
queue.enqueue();
getPlayer().sendMessage(TranslatableCaption.of("working.generating_component"));
});

View File

@ -263,6 +263,12 @@ public class HybridPlotManager extends ClassicPlotManager {
enqueue = true;
queue = hybridPlotWorld.getQueue();
}
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
queue.addProgressSubscriber(subscriberFactory.createWithActor(actor));
}
if (whenDone != null) {
queue.setCompleteTask(whenDone);
}
if (!canRegen) {
queue.setCuboid(pos1.withY(0), pos2.withY(0), bedrock);
// Each component has a different layer
@ -274,12 +280,6 @@ public class HybridPlotManager extends ClassicPlotManager {
queue.setRegenRegion(new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()));
}
pastePlotSchematic(queue, pos1, pos2);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
queue.addProgressSubscriber(subscriberFactory.createWithActor(actor));
}
if (whenDone != null) {
queue.setCompleteTask(whenDone);
}
return !enqueue || queue.enqueue();
}

View File

@ -14,7 +14,7 @@ guice = "5.0.1"
findbugs = "3.0.1"
worldedit = "7.2.5"
fawe = "p2v6-8"
fawe = "p2v6-9"
vault = "1.7"
placeholderapi = "2.10.9"
luckperms = "5.3"