@Override
	public void run()
	{
		while(System.currentTimeMillis()-startTime<time)
		{
			try
			{
				sleep((time-(System.currentTimeMillis()-startTime))*4/5);
			}
			catch(InterruptedException e)
			{
				e.printStackTrace();
			}
		}
		action();
		finished=true;
	}