/* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.model.entity;
import net.sf.l2j.gameserver.ThreadPoolManager;
/** This class is the L2J Oneo Event Task Manager
* This class runs the L2J Oneo Event Engines.
* Current Event Engines:
* 1. TvT Engine (TvTTask)
* 2. VIP Engine (VIPTask)
*
* @author Ahmed
*/
public class L2JOneoTaskManager implements Runnable
{
public static boolean Running = false;
public void run()
{
Running = true;
System.out.println("L2J Oneo Event Manager starting TvT Task.");
ThreadPoolManager.getInstance().scheduleGeneral(new TvTTask(), VIP._totalEventTime);
System.out.println("L2J Oneo Event Manager starting VIP Task.");
ThreadPoolManager.getInstance().scheduleGeneral(new VipTask(), TvTEvent._tvtTotalTime);
Running = false;
}
/**
* This method waits for a period time delay
*
* @param interval
*/
void waiter(int seconds)
{
while (seconds > 1)
{
seconds--;
long oneSecWaitStart = System.currentTimeMillis();
// only the try catch with Thread.sleep(1000) give bad count-down on high wait times
while (oneSecWaitStart + 1000L > System.currentTimeMillis())
{
try
{
Thread.sleep(1);
}
catch (InterruptedException ie)
{
// meh...
}
}
}
}
}