Register expiry tasks

This commit is contained in:
Jesse Boyd 2016-06-06 12:47:54 +10:00
parent f1f6b2781e
commit 880e084006
3 changed files with 16 additions and 2 deletions

View file

@ -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);
}
}
}

View file

@ -159,7 +159,15 @@ public class Config {
INSTANCES.put(key, value);
}
public Map<String, T> getRaw() {
public Collection<T> getInstances() {
return INSTANCES.values();
}
public Collection<String> getSections() {
return INSTANCES.keySet();
}
private Map<String, T> getRaw() {
return INSTANCES;
}
}

View file

@ -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<Boolean>() {
@Override
public void run(Boolean confirmation) {
expiredTask.run(plot, this, confirmation);
expiredTask.run(plot, task, confirmation);
}
}, new Runnable() {
@Override