mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Register expiry tasks
This commit is contained in:
parent
f1f6b2781e
commit
880e084006
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user