Fix compile errors surrounding new fixes

This commit is contained in:
Aria 2023-05-08 02:51:54 -07:00
parent c30a980ea0
commit 94ec7d3303
2 changed files with 14 additions and 6 deletions

View file

@ -40,7 +40,7 @@ public abstract class Task implements Runnable
{
DelayedExecutorService.scheduleTask(this, 1);
if(!isSilent)
DelayedExecutorService.scheduleTask(new SpinnerTask(token), 1);
DelayedExecutorService.scheduleTask(new SpinnerTask(token,this), 1);
}
public void stopTask()
@ -58,25 +58,28 @@ public abstract class Task implements Runnable
{
token.completed(FAIL);
}
public class SpinnerTask implements Runnable
public class SpinnerTask extends Task
{
public final Task task;
public final TaskCompletionToken token;
private final Progress spinner = new Progress(100);
public SpinnerTask (TaskCompletionToken token)
public SpinnerTask (TaskCompletionToken token, Task parent)
{
super("spinner",true);
this.token=token;
this.task=parent;
}
@Override
public void run()
{
while(!token.get())
while(!task.isComplete())
{
try {
Thread.sleep(1000L);
if(!isSilent)
System.out.printf("\r"+TASK_NAME+"\t\t"+spinner.getSpinnerTick());
System.out.printf("\r"+task.TASK_NAME+"\t\t"+spinner.getSpinnerTick());
}catch(Exception e)
{
e.printStackTrace();

View file

@ -5,11 +5,16 @@ import dev.zontreck.ariaslib.util.DelayedExecutorService;
import java.util.*;
public class TaskBus implements Runnable
public class TaskBus extends Task
{
public static List<Task> tasks = new ArrayList<>();
public static Task current = null;
public TaskBus()
{
super("TaskBus",true);
}
@Override
public void run()
{