Saber-Factions/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java

23 lines
685 B
Java
Raw Normal View History

package com.massivecraft.factions.util;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P;
2014-04-04 20:55:21 +02:00
public class AutoLeaveTask implements Runnable {
private static AutoLeaveProcessTask task;
double rate;
2014-04-04 20:55:21 +02:00
public AutoLeaveTask() {
this.rate = Conf.autoLeaveRoutineRunsEveryXMinutes;
}
2014-04-04 20:55:21 +02:00
public synchronized void run() {
2014-07-01 21:49:42 +02:00
if (task != null && !task.isFinished()) { return; }
2014-07-01 21:52:40 +02:00
task = new AutoLeaveProcessTask(); task.runTaskTimer(P.p, 1, 1);
2014-04-04 20:55:21 +02:00
// maybe setting has been changed? if so, restart this task at new rate
2014-07-01 21:49:42 +02:00
if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) { P.p.startAutoLeaveTask(true); }
2014-04-04 20:55:21 +02:00
}
}