Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
ac796675
Commit
ac796675
authored
Apr 27, 2022
by
Yazawazi
Browse files
comments
parent
a1230971
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/task/Task.java
View file @
ac796675
...
...
@@ -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"
;
...
...
src/main/java/emu/grasscutter/task/TaskMap.java
View file @
ac796675
...
...
@@ -79,7 +79,6 @@ public final class TaskMap {
private
void
scan
()
{
Reflections
reflector
=
Grasscutter
.
reflector
;
Set
<
Class
<?>>
classes
=
reflector
.
getTypesAnnotatedWith
(
Task
.
class
);
System
.
out
.
println
(
"Found "
+
classes
.
size
()
+
" tasks."
);
classes
.
forEach
(
annotated
->
{
try
{
Task
taskData
=
annotated
.
getAnnotation
(
Task
.
class
);
...
...
src/main/java/emu/grasscutter/task/tasks/MoonCard.java
View file @
ac796675
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment