From 880e08400694f20377df76a0af51b68318dccb0d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 6 Jun 2016 12:47:54 +1000 Subject: [PATCH] Register expiry tasks --- .../main/java/com/intellectualcrafters/plot/PS.java | 5 +++++ .../com/intellectualcrafters/plot/config/Config.java | 10 +++++++++- .../plot/util/expiry/ExpireManager.java | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 2034f70f8..e14485896 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -49,6 +49,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.area.QuadMap; import com.intellectualcrafters.plot.util.expiry.ExpireManager; +import com.intellectualcrafters.plot.util.expiry.ExpiryTask; import com.plotsquared.listener.WESubscriber; import com.sk89q.worldedit.WorldEdit; import java.io.File; @@ -386,6 +387,10 @@ public class PS { if (Settings.ENABLED_COMPONENTS.PLOT_EXPIRY) { ExpireManager.IMP = new ExpireManager(); ExpireManager.IMP.runAutomatedTask(); + for (Settings.AUTO_CLEAR settings : Settings.AUTO_CLEAR.getInstances()) { + ExpiryTask task = new ExpiryTask(settings); + ExpireManager.IMP.addTask(task); + } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java b/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java index 746d2283c..a61406158 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/Config.java @@ -159,7 +159,15 @@ public class Config { INSTANCES.put(key, value); } - public Map getRaw() { + public Collection getInstances() { + return INSTANCES.values(); + } + + public Collection getSections() { + return INSTANCES.keySet(); + } + + private Map getRaw() { return INSTANCES; } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java index 3d924d6c5..4f0c5c92b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java @@ -44,6 +44,7 @@ public class ExpireManager { } public void addTask(ExpiryTask task) { + PS.debug("Adding new expiry task!"); this.tasks.add(task); } @@ -242,7 +243,7 @@ public class ExpireManager { passesComplexity(changed, expired, new RunnableVal() { @Override public void run(Boolean confirmation) { - expiredTask.run(plot, this, confirmation); + expiredTask.run(plot, task, confirmation); } }, new Runnable() { @Override