using Minecraft.Server.FourKit.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Minecraft.Server.FourKit.Scheduler
{
public class FourKitTask
{
private ServerPlugin owner;
private int taskId;
internal bool shouldRun = true;
internal int startDelay;
internal int runCooldown;
internal int lastRunTick = -1;
internal bool startedRunning = false;
///
/// Initializes a new task instance with owner, task id, start delay, and run cooldown.
///
/// The plugin that owns this task.
/// Task id number.
/// Delay in server ticks before executing the task.
/// Period in server ticks between runs, or -1 for one-shot tasks.
internal FourKitTask(ServerPlugin owner, int taskId, int startDelay, int runCooldown)
{
this.owner = owner;
this.taskId = taskId;
this.startDelay = startDelay;
this.runCooldown = runCooldown;
}
///
/// Will attempt to cancel this task.
///
public void cancel() { shouldRun = false; }
///
/// Returns the Plugin that owns this task.
///
/// The Plugin that owns the task.
public ServerPlugin getOwner() { return owner; }
///
/// Returns the taskId for the task.
///
/// Task id number.
public int getTaskId() { return taskId; }
}
}