1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

Second attempt to fix archived jobs

This commit is contained in:
montlikadani 2021-01-16 13:41:46 +01:00
parent da5641ff37
commit fb91fb7104
2 changed files with 10 additions and 14 deletions

View File

@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version> <version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- McMMO --> <!-- McMMO -->

View File

@ -475,6 +475,8 @@ public class Placeholder {
return ""; return "";
JobProgression j = getProgFromValue(user, vals.get(0)); JobProgression j = getProgFromValue(user, vals.get(0));
Job job = getJobFromValue(vals.get(0));
switch (placeHolder) { switch (placeHolder) {
case limit_$1: case limit_$1:
CurrencyType t = CurrencyType.getByName(vals.get(0)); CurrencyType t = CurrencyType.getByName(vals.get(0));
@ -504,11 +506,7 @@ public class Placeholder {
CurrencyType.getByName(vals.get(1)))); CurrencyType.getByName(vals.get(1))));
case user_jtoplvl_$1_$2: case user_jtoplvl_$1_$2:
vals = placeHolder.getComplexValues(value); vals = placeHolder.getComplexValues(value);
if (vals.size() < 2) if (vals.size() < 2 || job == null)
return "";
Job job = getJobFromValue(vals.get(0));
if (job == null)
return ""; return "";
int amount = 0; int amount = 0;
@ -534,8 +532,7 @@ public class Placeholder {
if (vals.isEmpty()) if (vals.isEmpty())
return ""; return "";
Job jobs = getJobFromValue(vals.get(0)); return job == null ? "no" : convert(user.isInJob(job));
return jobs == null ? "no" : convert(user.isInJob(jobs));
case user_job_$1: case user_job_$1:
return j == null ? "" : j.getJob().getName(); return j == null ? "" : j.getJob().getName();
case user_title_$1: case user_title_$1:
@ -544,19 +541,18 @@ public class Placeholder {
Title title = Jobs.gettitleManager().getTitle(j.getLevel(), j.getJob().getName()); Title title = Jobs.gettitleManager().getTitle(j.getLevel(), j.getJob().getName());
return title == null ? "" : title.getChatColor() + title.getName(); return title == null ? "" : title.getChatColor() + title.getName();
case user_archived_jobs_level_$1: case user_archived_jobs_level_$1:
if (j == null) { if (job == null) {
return ""; return "";
} }
JobProgression archivedJobProg = user.getArchivedJobProgression(j.getJob()); JobProgression archivedJobProg = user.getArchivedJobProgression(job);
return archivedJobProg == null ? "" : Integer.toString(archivedJobProg.getLevel()); return archivedJobProg == null ? "" : Integer.toString(archivedJobProg.getLevel());
case user_archived_jobs_exp_$1: case user_archived_jobs_exp_$1:
if (j == null) { if (job == null)
return ""; return "";
}
JobProgression archivedJobProgression = user.getArchivedJobProgression(j.getJob()); JobProgression archivedJobProgression = user.getArchivedJobProgression(job);
return archivedJobProgression == null ? "" : Double.toString(archivedJobProgression.getExperience()); return archivedJobProgression == null ? "0" : Double.toString(archivedJobProgression.getExperience());
default: default:
break; break;
} }