diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 67a3d432..4922ddfb 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -25,18 +25,13 @@ public class quests implements Cmd { JobsPlayer jPlayer = null; boolean isPlayer = sender instanceof Player; - if (args.length >= 1 && isPlayer && args[0].equalsIgnoreCase("next")) { - jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); - jPlayer.resetQuests(); - } else { - if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) { - if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true)) - return true; + if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) { + if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true)) + return true; - jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); - } else if (isPlayer) - jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); - } + jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); + } else if (isPlayer) + jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); if (jPlayer == null) { if (args.length >= 1) @@ -69,8 +64,7 @@ public class quests implements Cmd { } sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%", - stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : - Jobs.getLanguage().getMessage("command.quests.status.started"))); + stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started"))); return true; } } diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 02e2ebb1..069e2880 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -1037,10 +1037,10 @@ public class JobsPlayer { public void resetQuests(List quests) { for (QuestProgression oneQ : quests) { + oneQ.reset(); Quest quest = oneQ.getQuest(); - if (quest != null) { - Map map = qProgression.remove(quest.getJob().getName()); + Map map = qProgression.get(quest.getJob().getName()); if (map != null) { map.clear(); diff --git a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java index 3efd4ba2..0fe33bde 100644 --- a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java @@ -6,6 +6,9 @@ import java.util.Map.Entry; import com.gamingmesh.jobs.actions.EnchantActionInfo; import com.gamingmesh.jobs.stuff.Util; + +import net.Zrips.CMILib.Logs.CMIDebug; + import org.bukkit.Bukkit; import org.bukkit.event.server.ServerCommandEvent; @@ -48,6 +51,12 @@ public class QuestProgression { return amountNeeded; } + public void reset() { + validUntil = quest.getValidUntil(); + givenReward = false; + done.clear(); + } + public int getTotalAmountDone() { int amountDone = 0; for (Integer one : done.values()) { @@ -122,10 +131,8 @@ public class QuestProgression { } } - if ( - !isCompleted() && - objective != null - ) { + if (!isCompleted() && + objective != null) { Integer old = done.getOrDefault(objective, 0); done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount()); } @@ -161,10 +168,8 @@ public class QuestProgression { return Util.enchantMatchesActionInfo(objectiveKey, (EnchantActionInfo) actionInfo); } - return ( - objectiveKey.equalsIgnoreCase(actionInfo.getNameWithSub()) || - objectiveKey.equalsIgnoreCase(actionInfo.getName()) - ); + return (objectiveKey.equalsIgnoreCase(actionInfo.getNameWithSub()) || + objectiveKey.equalsIgnoreCase(actionInfo.getName())); } private QuestObjective objectiveForAction(ActionInfo actionInfo) {