Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ dependencies {
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.11.6'
compileOnly 'org.jetbrains:annotations:23.0.0'

testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'org.mockito:mockito-junit-jupiter:4.11.0'
testImplementation 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
testImplementation 'org.jetbrains:annotations:23.0.0'
}

test {
useJUnitPlatform()
}

publishing {
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/me/playbosswar/com/tasks/ScheduledTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@

import java.time.ZonedDateTime;

import org.jetbrains.annotations.Nullable;

public class ScheduledTask {
private final Task task;
private final ZonedDateTime date;
@Nullable
private final TaskTime taskTime;

public ScheduledTask(Task task, ZonedDateTime date) {
this(task, date, null);
}

public ScheduledTask(Task task, ZonedDateTime date, @Nullable TaskTime taskTime) {
this.task = task;
this.date = date;
this.taskTime = taskTime;
}

public Task getTask() {
return task;
}

public ZonedDateTime getDate() {
return date;
}

@Nullable
public TaskTime getTaskTime() {
return taskTime;
}
}
7 changes: 7 additions & 0 deletions src/main/java/me/playbosswar/com/tasks/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ public void setExecutionLimit(int executionLimit) {
CommandTimerPlugin.getInstance().getTasksManager().resetScheduleForTask(this);
}

public void loadExecutionMetadata(int timesExecuted, Date lastExecuted, int lastExecutedCommandIndex) {
this.timesExecuted = timesExecuted;
this.lastExecuted = lastExecuted;
this.lastExecutedCommandIndex = lastExecutedCommandIndex;
// No storeExecutionMetadata() — we're restoring what's already on disk
}

public int getTimesExecuted() {
return timesExecuted;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/me/playbosswar/com/tasks/TaskRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.TimerTask;
import java.util.stream.Collectors;

/**
* Runnable responsible for scheduling tasks
Expand Down
Loading