diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 6b76822f..f9e18d6a 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -105,7 +105,6 @@ public class Jobs extends JavaPlugin { private static List jobs; private static Job noneJob; private static Map usedSlots = new WeakHashMap<>(); - private static Map jobsIds = new HashMap<>(); public static BufferedPaymentThread paymentThread; private static DatabaseSaveThread saveTask; @@ -478,20 +477,19 @@ public class Jobs extends JavaPlugin { * @return {@link Job} */ public static Job getJob(int id) { - return jobsIds.get(id); + for (Job job : jobs) { + if (job.getId() == id) { + return job; + } + } + + return null; } public boolean isPlaceholderAPIEnabled() { return placeholderAPIEnabled; } - /** - * @return the cached job id map. - */ - public static Map getJobsIds() { - return jobsIds; - } - private void startup() { reload(true); diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index 45907d0d..b5e0ed05 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -579,11 +579,7 @@ public class Job { } public void setId(int id) { - Jobs.getJobsIds().remove(this.id); - this.id = id; - if (id != 0) - Jobs.getJobsIds().put(id, this); } public List getWorldBlacklist() {