1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

New placeholder %jobsr_user_jmexp_$1%

This commit is contained in:
Zrips 2022-03-07 15:11:10 +02:00
parent ffade2e7b8
commit a811f79b1d

View File

@ -74,6 +74,7 @@ public class Placeholder {
user_canjoin_$1("jname/number"),
user_jlevel_$1("jname/number"),
user_jexp_$1("jname/number"),
user_jmexp_$1("jname/number"),
user_jexp_rounded_$1("jname/number"),
user_jmaxexp_$1("jname/number"),
user_jexpunf_$1("jname/number"),
@ -223,7 +224,7 @@ public class Placeholder {
name = name.replace(one, "*");
i++;
}
return name;
}
return this.getName();
@ -507,6 +508,8 @@ public class Placeholder {
return j == null ? "0" : j.getLevelFormatted();
case user_jexp_$1:
return j == null ? "0" : format.format(j.getExperience());
case user_jmexp_$1:
return j == null ? "0" : format.format(j.getMaxExperience() - j.getExperience());
case user_jexp_rounded_$1:
return j == null ? "0" : new DecimalFormat("##.###").format(j.getExperience());
case user_jmaxexp_$1:
@ -519,27 +522,27 @@ public class Placeholder {
return j == null ? "0" : Integer.toString(j.getJob().getMaxLevel(user));
case user_boost_$1_$2:
return (vals.size() < 2 || j == null) ? "" : simplifyDouble(user.getBoost(j.getJob().getName(),
CurrencyType.getByName(vals.get(1))));
CurrencyType.getByName(vals.get(1))));
case user_jtoplvl_$1_$2:
if (vals.size() < 2 || job == null)
return "";
try {
jobLevel.set(Integer.parseInt(vals.get(1)));
} catch (NumberFormatException e) {
return "";
try {
jobLevel.set(Integer.parseInt(vals.get(1)));
} catch (NumberFormatException e) {
return "";
}
return CompletableFuture.supplyAsync(() -> {
for (TopList l : Jobs.getJobsDAO().getGlobalTopList(jobLevel.get())) {
if (l.getPlayerInfo().getName().equals(user.getName())) {
JobProgression prog = l.getPlayerInfo().getJobsPlayer().getJobProgression(job);
return prog == null ? "" : prog.getLevelFormatted();
}
}
return CompletableFuture.supplyAsync(() -> {
for (TopList l : Jobs.getJobsDAO().getGlobalTopList(jobLevel.get())) {
if (l.getPlayerInfo().getName().equals(user.getName())) {
JobProgression prog = l.getPlayerInfo().getJobsPlayer().getJobProgression(job);
return prog == null ? "" : prog.getLevelFormatted();
}
}
return "";
}).join();
return "";
}).join();
case user_isin_$1:
return job == null ? "no" : convert(user.isInJob(job));
case user_job_$1:
@ -592,12 +595,12 @@ public class Placeholder {
return convert(confMaxJobs > 0 && playerMaxJobs >= confMaxJobs
&& !Jobs.getPlayerManager().getJobsLimit(user, playerMaxJobs));
case maxjobs:
return Integer.toString(Jobs.getPlayerManager().getMaxJobs(user));
case maxjobs:
return Integer.toString(Jobs.getPlayerManager().getMaxJobs(user));
default:
break;
}
}
}
}
}