2012-02-26 23:55:57 +01:00
|
|
|
package com.massivecraft.factions.util;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
2019-08-02 23:01:33 +02:00
|
|
|
import com.massivecraft.factions.P;
|
2012-02-26 23:55:57 +01:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class AutoLeaveTask implements Runnable {
|
2014-08-05 17:17:27 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
private static AutoLeaveProcessTask task;
|
|
|
|
double rate;
|
2012-02-26 23:55:57 +01:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
public AutoLeaveTask() {
|
|
|
|
this.rate = Conf.autoLeaveRoutineRunsEveryXMinutes;
|
|
|
|
}
|
2012-02-26 23:55:57 +01:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
public synchronized void run() {
|
|
|
|
if (task != null && !task.isFinished()) {
|
|
|
|
return;
|
|
|
|
}
|
2012-02-26 23:55:57 +01:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
task = new AutoLeaveProcessTask();
|
2019-08-02 23:01:33 +02:00
|
|
|
task.runTaskTimer(P.p, 1, 1);
|
2013-04-22 03:26:19 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
// 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);
|
2019-03-03 04:51:21 +01:00
|
|
|
}
|
|
|
|
}
|
2012-02-26 23:55:57 +01:00
|
|
|
}
|