RuneHive-Game
Loading...
Searching...
No Matches
Job.java
Go to the documentation of this file.
1package com.runehive.game.world.cronjobs;
2
3import com.runehive.game.world.World;
4import org.quartz.JobExecutionContext;
5
6public abstract class Job implements org.quartz.Job {
7
8 private final String name;
9
10 protected Job(String name) {
11 this.name = name;
12 }
13
14 @Override
15 public void execute(JobExecutionContext jobExecutionContext) {
16 System.out.println("Firing " + name + " job");
17
18 final Job job = this;
19 World.schedule(1, () -> {
20 try {
21 job.execute();
22 } catch (Exception e) {
23 System.err.println("An error occurred in " + job.name + " job");
24 }
25 });
26 }
27
28 public abstract void execute();
29}
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
void execute(JobExecutionContext jobExecutionContext)
Definition Job.java:15