From 4d23d9025299ec15ab9da665676a97285a2d70f7 Mon Sep 17 00:00:00 2001 From: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Date: Wed, 27 Apr 2022 07:08:33 +0800 Subject: [PATCH] comments --- src/main/java/emu/grasscutter/task/Task.java | 14 ++++++++++++++ src/main/java/emu/grasscutter/task/TaskMap.java | 1 - .../java/emu/grasscutter/task/tasks/MoonCard.java | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/task/Task.java b/src/main/java/emu/grasscutter/task/Task.java index 88c0ac20c..6ff71b943 100644 --- a/src/main/java/emu/grasscutter/task/Task.java +++ b/src/main/java/emu/grasscutter/task/Task.java @@ -3,6 +3,20 @@ package emu.grasscutter.task; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; + +/* +* So what is cron expression? +* Check this: https://en.wikipedia.org/wiki/Cron +# ┌───────────── minute (0 - 59) +# │ ┌───────────── hour (0 - 23) +# │ │ ┌───────────── day of the month (1 - 31) +# │ │ │ ┌───────────── month (1 - 12) +# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; +# │ │ │ │ │ 7 is also Sunday on some systems) +# │ │ │ │ │ +# │ │ │ │ │ +# * * * * * +* */ @Retention(RetentionPolicy.RUNTIME) public @interface Task { String taskName() default "NO_NAME"; diff --git a/src/main/java/emu/grasscutter/task/TaskMap.java b/src/main/java/emu/grasscutter/task/TaskMap.java index 95be8bb70..3da550a67 100644 --- a/src/main/java/emu/grasscutter/task/TaskMap.java +++ b/src/main/java/emu/grasscutter/task/TaskMap.java @@ -79,7 +79,6 @@ public final class TaskMap { private void scan() { Reflections reflector = Grasscutter.reflector; Set> classes = reflector.getTypesAnnotatedWith(Task.class); - System.out.println("Found " + classes.size() + " tasks."); classes.forEach(annotated -> { try { Task taskData = annotated.getAnnotation(Task.class); diff --git a/src/main/java/emu/grasscutter/task/tasks/MoonCard.java b/src/main/java/emu/grasscutter/task/tasks/MoonCard.java index 71121bcc2..26f7b9788 100644 --- a/src/main/java/emu/grasscutter/task/tasks/MoonCard.java +++ b/src/main/java/emu/grasscutter/task/tasks/MoonCard.java @@ -11,6 +11,7 @@ import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @Task(taskName = "MoonCard", taskCronExpression = "0 0 0 * * ?", triggerName = "MoonCardTrigger") +// taskCronExpression: Fixed time period: 0:0:0 every day (twenty-four hour system) public final class MoonCard implements TaskHandler { @Override public void execute(JobExecutionContext context) throws JobExecutionException {