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

29 lines
650 B
Java
Raw Normal View History

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