1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +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> <dependency>
<groupId>de.Keyle.MyPet</groupId> <groupId>de.Keyle.MyPet</groupId>
<artifactId>MyPet</artifactId> <artifactId>MyPet</artifactId>
<version>3.5</version> <version>3.7</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/MyPet-3.5.jar</systemPath> <systemPath>${basedir}/libs/MyPet-3.7.jar</systemPath>
</dependency> </dependency>
<!-- McMMO --> <!-- McMMO -->
<dependency> <dependency>

View File

@ -67,8 +67,7 @@ public class quests implements Cmd {
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover"); List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>(); List<String> hoverList = new ArrayList<>();
for (int i = 0; i < hoverMsgs.size(); i++) { for (String current : hoverMsgs) {
String current = hoverMsgs.get(i);
current = current.replace("[jobName]", jobProg.getJob().getName()); current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); current = current.replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
if (current.contains("[desc]")) { if (current.contains("[desc]")) {
@ -77,7 +76,6 @@ public class quests implements Cmd {
} }
} else } else
hoverList.add(current); hoverList.add(current);
} }
for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) { 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.commands.JobCommand;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
public class resetquest implements Cmd { public class resetquest implements Cmd {
@ -54,8 +55,14 @@ public class resetquest implements Cmd {
for (QuestProgression one : quests) { for (QuestProgression one : quests) {
one.setValidUntil(System.currentTimeMillis()); 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())); sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getUserName()));
return true; return true;

View File

@ -860,13 +860,29 @@ public class JobsPlayer {
return ls; 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() { public void resetQuests() {
for (JobProgression one : getJobProgression()) { for (JobProgression one : getJobProgression()) {
for (QuestProgression oneQ : getQuestProgressions(one.getJob())) { 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); oneQ.setValidUntil(0L);
} }
setDoneQuests(0);
getQuestProgressions(one.getJob()).clear();
} }
getQuestProgressions();
} }
public List<QuestProgression> getQuestProgressions() { public List<QuestProgression> getQuestProgressions() {