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, final @NonNull Pattern blocks,
int minY, int minY,
int maxY, int maxY,
@org.checkerframework.checker.nullness.qual.Nullable PlotPlayer<?> actor, @Nullable PlotPlayer<?> actor,
@org.checkerframework.checker.nullness.qual.Nullable QueueCoordinator queue @Nullable QueueCoordinator queue
) { ) {
return delegate.setCuboids(area, regions, blocks, minY, maxY); return delegate.setCuboids(area, regions, blocks, minY, maxY, queue.getCompleteTask());
} }
@Override @Override

View File

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

View File

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

View File

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

View File

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

View File

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