All pastes #717868 Raw Edit

L2JOneo Task

public java v1 · immutable
#717868 ·published 2007-09-27 22:41 UTC
rendered paste body
/* 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 <br> * This class runs the L2J Oneo Event Engines. <br> * Current Event Engines: <br> * 		1. TvT Engine (TvTTask) <br> * 		2. VIP Engine (VIPTask) <br> * * @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<br><br>	 *	 * @param interval<br>	 */	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...				}			}		}	}}