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