2013-04-18 12:29:56 +02:00
|
|
|
package com.massivecraft.factions.task;
|
2012-02-26 23:55:58 +01:00
|
|
|
|
2013-04-09 13:15:25 +02:00
|
|
|
import com.massivecraft.factions.ConfServer;
|
2013-04-22 17:59:51 +02:00
|
|
|
import com.massivecraft.factions.entity.UPlayerColl;
|
|
|
|
import com.massivecraft.factions.entity.UPlayerColls;
|
2013-04-18 13:36:52 +02:00
|
|
|
import com.massivecraft.mcore.ModuloRepeatTask;
|
|
|
|
import com.massivecraft.mcore.util.TimeUnit;
|
2012-02-26 23:55:58 +01:00
|
|
|
|
2013-04-18 13:36:52 +02:00
|
|
|
public class AutoLeaveTask extends ModuloRepeatTask
|
2012-02-26 23:55:58 +01:00
|
|
|
{
|
2013-04-18 13:36:52 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// INSTANCE & CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
private static AutoLeaveTask i = new AutoLeaveTask();
|
|
|
|
public static AutoLeaveTask get() { return i; }
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE: MODULO REPEAT TASK
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getDelayMillis()
|
2012-02-26 23:55:58 +01:00
|
|
|
{
|
2013-04-18 13:36:52 +02:00
|
|
|
return (long) (ConfServer.autoLeaveRoutineRunsEveryXMinutes * TimeUnit.MILLIS_PER_MINUTE);
|
2012-02-26 23:55:58 +01:00
|
|
|
}
|
2013-04-18 13:36:52 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setDelayMillis(long delayMillis)
|
|
|
|
{
|
|
|
|
throw new RuntimeException("operation not supported");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void invoke()
|
2012-02-26 23:55:58 +01:00
|
|
|
{
|
2013-04-22 17:59:51 +02:00
|
|
|
for (UPlayerColl coll : UPlayerColls.get().getColls())
|
2013-04-22 12:26:13 +02:00
|
|
|
{
|
|
|
|
coll.autoLeaveOnInactivityRoutine();
|
|
|
|
}
|
2012-02-26 23:55:58 +01:00
|
|
|
}
|
2013-04-18 13:36:52 +02:00
|
|
|
|
2012-02-26 23:55:58 +01:00
|
|
|
}
|