From b71de856a85fac2b7979199ba242c8cd17728ab5 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 1 Jul 2020 20:04:37 +0100 Subject: [PATCH] allow plugins extending and replacing RegionManager to be notified of, and "accept" plot clear "requests". . . . . . FAWE --- .../com/plotsquared/core/util/RegionManager.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index ab3333a19..9f6c64696 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -29,6 +29,7 @@ import com.plotsquared.core.PlotSquared; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; +import com.plotsquared.core.plot.PlotManager; import com.plotsquared.core.queue.LocalBlockQueue; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; @@ -163,6 +164,20 @@ public abstract class RegionManager { return queue.enqueue(); } + /** + * Notify any plugins that may want to modify clear behaviour that a clear is occuring + * + * @return true if the notified will accept the clear task + */ + public boolean notifyClear() { + return false; + } + + /** + * Only called when {@link RegionManager#notifyClear()} returns true in specific PlotManagers + */ + public abstract boolean handleClear(Plot plot, final Runnable whenDone, PlotManager manager); + /** * Copy a region to a new location (in the same world) */