1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Resetquest now fully reseting the quest

This is because so many users wanted this command to not only restore time, but the entire completed and completed quest.
This commit is contained in:
montlikadani 2019-08-11 14:36:43 +02:00
parent 3a23f8be31
commit a569f84a73
5 changed files with 27 additions and 6 deletions

View File

@ -23,9 +23,9 @@
<dependency>
<groupId>de.Keyle.MyPet</groupId>
<artifactId>MyPet</artifactId>
<version>3.5</version>
<version>3.7</version>
<scope>system</scope>
<systemPath>${basedir}/libs/MyPet-3.5.jar</systemPath>
<systemPath>${basedir}/libs/MyPet-3.7.jar</systemPath>
</dependency>
<!-- McMMO -->
<dependency>

View File

@ -67,8 +67,7 @@ public class quests implements Cmd {
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>();
for (int i = 0; i < hoverMsgs.size(); i++) {
String current = hoverMsgs.get(i);
for (String current : hoverMsgs) {
current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
if (current.contains("[desc]")) {
@ -77,7 +76,6 @@ public class quests implements Cmd {
}
} else
hoverList.add(current);
}
for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) {

View File

@ -10,6 +10,7 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression;
public class resetquest implements Cmd {
@ -54,8 +55,14 @@ public class resetquest implements Cmd {
for (QuestProgression one : quests) {
one.setValidUntil(System.currentTimeMillis());
for (java.util.Map.Entry<String, QuestObjective> obj : one.getQuest().getObjectives().entrySet()) {
one.setAmountDone(obj.getValue(), 0);
}
}
jPlayer.setDoneQuests(0);
jPlayer.getQuestProgressions(job).clear();
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getUserName()));
return true;

View File

@ -860,13 +860,29 @@ public class JobsPlayer {
return ls;
}
public void resetQuests(Job job) {
for (QuestProgression oneQ : getQuestProgressions(job)) {
oneQ.setValidUntil(0l);
for (java.util.Map.Entry<String, QuestObjective> obj : oneQ.getQuest().getObjectives().entrySet()) {
oneQ.setAmountDone(obj.getValue(), 0);
}
setDoneQuests(0);
getQuestProgressions(job).clear();
}
}
public void resetQuests() {
for (JobProgression one : getJobProgression()) {
for (QuestProgression oneQ : getQuestProgressions(one.getJob())) {
for (java.util.Map.Entry<String, QuestObjective> obj : oneQ.getQuest().getObjectives().entrySet()) {
oneQ.setAmountDone(obj.getValue(), 0);
}
oneQ.setValidUntil(0L);
}
setDoneQuests(0);
getQuestProgressions(one.getJob()).clear();
}
getQuestProgressions();
}
public List<QuestProgression> getQuestProgressions() {