diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 95ae5a64..11365624 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -963,10 +963,7 @@ public class Jobs extends JavaPlugin { // no job if (numjobs == 0) { - if (noneJob == null) - return; - - if (noneJob.isWorldBlackListed(block) || noneJob.isWorldBlackListed(block, ent) || noneJob.isWorldBlackListed(victim)) + if (noneJob == null || noneJob.isWorldBlackListed(block) || noneJob.isWorldBlackListed(block, ent) || noneJob.isWorldBlackListed(victim)) return; JobInfo jobinfo = noneJob.getJobInfo(info, 1); diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index b9e6bb4d..f0c1a58a 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -1141,11 +1141,10 @@ public class ConfigManager { if (sqsection.isString("Target")) { ActionType actionType = ActionType.getByName(sqsection.getString("Action")); - KeyValues kv = getKeyValue(sqsection.getString("Target"), actionType, jobFullName); + KeyValues kv = getKeyValue(sqsection.getString("Target").toUpperCase(), actionType, jobFullName); if (kv != null) { int amount = sqsection.getInt("Amount", 1); - QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), kv.getType() + kv.getSubType(), amount); - quest.addObjective(objective); + quest.addObjective(new QuestObjective(actionType, kv.getId(), kv.getMeta(), (kv.getType() + kv.getSubType()).toUpperCase(), amount)); } } @@ -1159,7 +1158,7 @@ public class ConfigManager { try { ActionType actionType = ActionType.getByName(split[0]); - String mats = split[1]; + String mats = split[1].toUpperCase(); String[] co = mats.split(","); int amount = 1; @@ -1175,14 +1174,14 @@ public class ConfigManager { } QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), - kv.getType() + kv.getSubType(), amount); + (kv.getType() + kv.getSubType()).toUpperCase(), amount); quest.addObjective(objective); } } else { KeyValues kv = getKeyValue(mats, actionType, jobFullName); if (kv != null) { QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), - kv.getType() + kv.getSubType(), amount); + (kv.getType() + kv.getSubType()).toUpperCase(), amount); quest.addObjective(objective); } } diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 4f34dcd1..0275e2b5 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -1083,8 +1083,7 @@ public class JobsPlayer { if (qProg != null) g = new HashMap<>(qProg); - Map tmp = new HashMap<>(); - for (Entry one : (new HashMap<>(g)).entrySet()) { + for (Entry one : new HashMap<>(g).entrySet()) { QuestProgression qp = one.getValue(); if (qp.isEnded()) { @@ -1098,8 +1097,7 @@ public class JobsPlayer { while (i <= job.getQuests().size()) { ++i; - List currentQuests = new ArrayList<>(g.keySet()); - Quest q = job.getNextQuest(currentQuests, getJobProgression(job).getLevel()); + Quest q = job.getNextQuest(new ArrayList<>(g.keySet()), getJobProgression(job).getLevel()); if (q == null) continue; @@ -1126,6 +1124,7 @@ public class JobsPlayer { qProgression.put(job.getName(), g); + Map tmp = new HashMap<>(); for (QuestProgression oneJ : g.values()) { Quest q = oneJ.getQuest(); if (q == null) { @@ -1219,13 +1218,13 @@ public class JobsPlayer { if (action == null || oneA.length() < prog.length() + 1) continue; - oneA = oneA.substring(prog.length() + 1); - - String target = oneA.split(";")[0]; Map old = quest.getObjectives().get(action); if (old == null) continue; + oneA = oneA.substring(prog.length() + 1); + + String target = oneA.split(";")[0]; QuestObjective obj = old.get(target); if (obj == null) continue; diff --git a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java index 4e425c9d..5d238ebf 100644 --- a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java @@ -92,21 +92,21 @@ public class QuestProgression { if (quest.isStopped() || !quest.hasAction(action.getType())) return; - if (!quest.getObjectives().containsKey(action.getType()) || !quest.getObjectives().get(action.getType()).containsKey(action.getNameWithSub()) && !quest.getObjectives().get(action.getType()) - .containsKey(action.getName())) + Map map = quest.getObjectives().get(action.getType()); + if (map == null || (!map.containsKey(action.getNameWithSub()) && !map.containsKey(action.getName()))) return; for (String area : quest.getRestrictedAreas()) { for (Entry a : Jobs.getRestrictedAreaManager().getRestrictedAres().entrySet()) { - if (quest.getRestrictedAreas().contains(a.getKey()) && a.getKey().equalsIgnoreCase(area) - && a.getValue().inRestrictedArea(jPlayer.getPlayer().getLocation())) { + if (a.getKey().equalsIgnoreCase(area) && a.getValue().inRestrictedArea(jPlayer.getPlayer().getLocation())) { return; } } } - if (quest.getJob() != null) { - int maxQuest = jPlayer.getPlayerMaxQuest(quest.getJob().getName()); + Job questJob = quest.getJob(); + if (questJob != null) { + int maxQuest = jPlayer.getPlayerMaxQuest(questJob.getName()); if (maxQuest > 0 && jPlayer.getDoneQuests() >= maxQuest) { return; } @@ -135,7 +135,7 @@ public class QuestProgression { givenReward = true; - jPlayer.addDoneQuest(quest.getJob()); + jPlayer.addDoneQuest(questJob); for (String one : quest.getRewardCmds()) { ServerCommandEvent ev = new ServerCommandEvent(Bukkit.getConsoleSender(), one.replace("[playerName]", jPlayer.getPlayer().getName()));