1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-04-06 04:06:08 +02:00

Now the command boost works again

This commit is contained in:
montlikadani 2020-04-16 18:05:09 +02:00
parent 47280b04d0
commit 4115bf727a
4 changed files with 21 additions and 42 deletions

View File

@ -101,20 +101,11 @@ public class expboost implements Cmd {
return true; return true;
} }
boolean found = false; job.addBoost(CurrencyType.EXP, 1.0);
for (Job one : Jobs.getJobs()) {
if (one.getName().equalsIgnoreCase(args[1])) {
one.addBoost(CurrencyType.EXP, 1.0);
found = true;
break;
}
}
if (found) { sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%",
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName()));
job.getName())); return true;
return true;
}
} }
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);

View File

@ -101,20 +101,11 @@ public class moneyboost implements Cmd {
return true; return true;
} }
boolean found = false; job.addBoost(CurrencyType.MONEY, 1.0);
for (Job one : Jobs.getJobs()) {
if (one.getName().equalsIgnoreCase(args[1])) {
one.addBoost(CurrencyType.MONEY, 1.0);
found = true;
break;
}
}
if (found) { sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%",
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", job.getName()));
"%jobname%", job.getName())); return true;
return true;
}
} }
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);

View File

@ -101,20 +101,11 @@ public class pointboost implements Cmd {
return true; return true;
} }
boolean found = false; job.addBoost(CurrencyType.POINTS, 1.0);
for (Job one : Jobs.getJobs()) {
if (one.getName().equalsIgnoreCase(args[1])) {
one.addBoost(CurrencyType.POINTS, 1.0);
found = true;
break;
}
}
if (found) { sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%",
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", job.getName()));
"%jobname%", job.getName())); return true;
return true;
}
} }
Job job = Jobs.getJob(args[0]); Job job = Jobs.getJob(args[0]);

View File

@ -56,17 +56,23 @@ public class Boost {
public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) { public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {
double r = 0D; double r = 0D;
for (BoostOf one : BoostOf.values()) { for (BoostOf one : BoostOf.values()) {
if (!map.containsKey(one)) if (!map.containsKey(one))
continue; continue;
if (excludeExtra && (one == BoostOf.NearSpawner || one == BoostOf.PetPay)) if (excludeExtra && (one == BoostOf.NearSpawner || one == BoostOf.PetPay))
continue; continue;
if (!map.get(one).isValid())
continue;
r += map.get(one).get(BT); r += map.get(one).get(BT);
} }
if (r < -1) if (r < -1)
r = -1; r = -1;
if (percent)
return (int) (r * 100); return percent ? (int) (r * 100) : r;
return r;
} }
} }