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