PlotSquared/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java

39 lines
1.0 KiB
Java
Raw Normal View History

2015-01-09 15:05:10 +01:00
package com.intellectualcrafters.plot.util;
2015-02-11 07:08:14 +01:00
import java.util.HashSet;
2015-02-19 07:08:15 +01:00
import com.intellectualcrafters.plot.PlotSquared;
2015-01-09 15:05:10 +01:00
2015-02-19 07:08:15 +01:00
public abstract class TaskManager {
2015-02-11 07:08:14 +01:00
2015-02-19 07:08:15 +01:00
public HashSet<String> TELEPORT_QUEUE = new HashSet<>();
public abstract void taskRepeat(final Runnable r, int interval);
public abstract void taskAsync(final Runnable r);
public abstract void task(final Runnable r);
public abstract void taskLater(final Runnable r, int delay);
public static void runTaskRepeat(final Runnable r, int interval) {
if (r != null)
PlotSquared.TASK.taskRepeat(r, interval);
}
2015-02-11 07:08:14 +01:00
2015-02-15 16:22:00 +01:00
public static void runTaskAsync(final Runnable r) {
2015-02-19 07:08:15 +01:00
if (r != null)
PlotSquared.TASK.taskAsync(r);
2015-01-09 15:05:10 +01:00
}
2015-01-31 08:09:48 +01:00
2015-02-15 16:22:00 +01:00
public static void runTask(final Runnable r) {
2015-02-19 07:08:15 +01:00
if (r != null)
PlotSquared.TASK.task(r);
2015-02-15 16:22:00 +01:00
}
2015-01-31 08:09:48 +01:00
public static void runTaskLater(final Runnable r, int delay) {
2015-02-19 07:08:15 +01:00
if (r != null)
PlotSquared.TASK.taskLater(r, delay);
2015-01-31 08:09:48 +01:00
}
2015-01-09 15:05:10 +01:00
}