1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Fix when the bonus not works correctly

https://github.com/Zrips/Jobs/issues/365#issuecomment-664134673
This commit is contained in:
montlikadani 2020-07-27 11:19:08 +02:00
parent ba9610618a
commit 47d4cd1258
3 changed files with 9 additions and 15 deletions

View File

@ -144,7 +144,6 @@ public class PermissionManager {
try {
t = Double.parseDouble(uno.getKey().replace(perm, ""));
} catch (NumberFormatException e) {
continue;
}
amount += t;

View File

@ -478,7 +478,7 @@ public class Placeholder {
CurrencyType.getByName(vals.get(1))));
case user_jtoplvl_$1_$2:
vals = placeHolder.getComplexValues(value);
if (vals.isEmpty())
if (vals.isEmpty() || vals.size() < 2)
return "";
Job job = getJobFromValue(vals.get(0));

View File

@ -1039,6 +1039,7 @@ public class JobsPlayer {
int i = g.size();
while (i > 0) {
--i;
g.remove(g.entrySet().iterator().next().getKey());
if (g.size() <= job.getMaxDailyQuests())
@ -1082,20 +1083,20 @@ public class JobsPlayer {
for (QuestProgression one : getQuestProgressions()) {
Quest q = one.getQuest();
if (q == null) {
if (q == null || q.getObjectives().isEmpty())
continue;
}
if (q.getObjectives().isEmpty())
continue;
if (!prog.isEmpty())
prog += ";:;";
prog += q.getJob().getName() + ":" + q.getConfigName() + ":" + one.getValidUntil() + ":";
for (Entry<ActionType, HashMap<String, QuestObjective>> oneA : q.getObjectives().entrySet()) {
for (Entry<String, QuestObjective> oneO : oneA.getValue().entrySet()) {
prog += oneO.getValue().getAction().toString() + ";" + oneO.getKey() + ";" + one.getAmountDone(oneO.getValue()) + ":;:";
}
}
prog = prog.endsWith(":;:") ? prog.substring(0, prog.length() - 3) : prog;
}
@ -1105,21 +1106,18 @@ public class JobsPlayer {
public void setQuestProgressionFromString(String qprog) {
if (qprog == null || qprog.isEmpty())
return;
String[] byJob = qprog.split(";:;");
for (String one : byJob) {
try {
String jname = one.split(":")[0];
Job job = Jobs.getJob(jname);
if (job == null)
continue;
one = one.substring(jname.length() + 1);
String qname = one.split(":")[0];
Quest quest = job.getQuest(qname);
if (quest == null)
continue;
@ -1143,13 +1141,11 @@ public class JobsPlayer {
}
for (String oneA : one.split(":;:")) {
String prog = oneA.split(";")[0];
ActionType action = ActionType.getByName(prog);
if (action == null)
continue;
if (oneA.length() < prog.length() + 1)
if (action == null || oneA.length() < prog.length() + 1)
continue;
oneA = oneA.substring(prog.length() + 1);
String target = oneA.split(";")[0];
@ -1158,7 +1154,6 @@ public class JobsPlayer {
continue;
QuestObjective obj = old.get(target);
if (obj == null)
continue;