1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-12 18:31:32 +01:00

Cumulative needs to be false by default.

This commit is contained in:
Zrips 2020-09-28 12:45:37 +03:00
parent d00d4a59a6
commit 497673f2dc
2 changed files with 16 additions and 17 deletions

View File

@ -120,9 +120,9 @@ public class PermissionManager {
return getMaxPermission(jPlayer, perm, false);
}
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force) {
return getMaxPermission(jPlayer, perm, force, true);
}
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force) {
return getMaxPermission(jPlayer, perm, force, false);
}
public Double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force, boolean cumulative) {
if (jPlayer == null || jPlayer.getPlayer() == null)
@ -146,19 +146,19 @@ public class PermissionManager {
double amount = 0D;
for (Map.Entry<String, Boolean> permission : permissions.entrySet()) {
if (!permission.getKey().startsWith(perm) || !permission.getValue())
continue;
if (!permission.getKey().startsWith(perm) || !permission.getValue())
continue;
try {
double temp = Double.parseDouble(permission.getKey().replace(perm, ""));
try {
double temp = Double.parseDouble(permission.getKey().replace(perm, ""));
if (cumulative)
amount += temp;
else if (temp > amount)
amount = temp;
if (cumulative)
amount += temp;
else if (temp > amount)
amount = temp;
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {
}
}
return amount;

View File

@ -58,16 +58,15 @@ public class join implements Cmd {
return true;
}
short PlayerMaxJobs = (short) jPlayer.getJobProgression().size();
if (!Jobs.getPlayerManager().getJobsLimit(jPlayer, PlayerMaxJobs)) {
if (!Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.getJobProgression().size())) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
return true;
}
if (args.length == 2 && args[1].equalsIgnoreCase("-needConfirmation")) {
new RawMessage().addText(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()))
.addHover(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()))
.addCommand("jobs join " + job.getName()).show(pSender);
.addHover(Jobs.getLanguage().getMessage("command.join.confirm", "[jobname]", job.getName()))
.addCommand("jobs join " + job.getName()).show(pSender);
return true;
}