Saber-Factions/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java
2018-11-07 10:14:42 -06:00

29 lines
783 B
Java

package com.massivecraft.factions.util;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.SavageFactions;
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();
task.runTaskTimer(SavageFactions.plugin, 1, 1);
// maybe setting has been changed? if so, restart this task at new rate
if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) {
SavageFactions.plugin.startAutoLeaveTask(true);
}
}
}