mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Get rid from storing job ids directly, now we uses the one from Job
This commit is contained in:
parent
9c0787c03d
commit
bf1d0b7a01
@ -105,7 +105,6 @@ public class Jobs extends JavaPlugin {
|
|||||||
private static List<Job> jobs;
|
private static List<Job> jobs;
|
||||||
private static Job noneJob;
|
private static Job noneJob;
|
||||||
private static Map<Job, Integer> usedSlots = new WeakHashMap<>();
|
private static Map<Job, Integer> usedSlots = new WeakHashMap<>();
|
||||||
private static Map<Integer, Job> jobsIds = new HashMap<>();
|
|
||||||
|
|
||||||
public static BufferedPaymentThread paymentThread;
|
public static BufferedPaymentThread paymentThread;
|
||||||
private static DatabaseSaveThread saveTask;
|
private static DatabaseSaveThread saveTask;
|
||||||
@ -478,20 +477,19 @@ public class Jobs extends JavaPlugin {
|
|||||||
* @return {@link Job}
|
* @return {@link Job}
|
||||||
*/
|
*/
|
||||||
public static Job getJob(int id) {
|
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() {
|
public boolean isPlaceholderAPIEnabled() {
|
||||||
return placeholderAPIEnabled;
|
return placeholderAPIEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the cached job id map.
|
|
||||||
*/
|
|
||||||
public static Map<Integer, Job> getJobsIds() {
|
|
||||||
return jobsIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startup() {
|
private void startup() {
|
||||||
reload(true);
|
reload(true);
|
||||||
|
|
||||||
|
@ -579,11 +579,7 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
Jobs.getJobsIds().remove(this.id);
|
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
if (id != 0)
|
|
||||||
Jobs.getJobsIds().put(id, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getWorldBlacklist() {
|
public List<String> getWorldBlacklist() {
|
||||||
|
Loading…
Reference in New Issue
Block a user