mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Removing /jobs quests next command
This commit is contained in:
parent
87587d3852
commit
1f98b5fb2b
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1037,10 +1037,10 @@ public class JobsPlayer {
|
||||
|
||||
public void resetQuests(List<QuestProgression> quests) {
|
||||
for (QuestProgression oneQ : quests) {
|
||||
oneQ.reset();
|
||||
Quest quest = oneQ.getQuest();
|
||||
|
||||
if (quest != null) {
|
||||
Map<String, QuestProgression> map = qProgression.remove(quest.getJob().getName());
|
||||
Map<String, QuestProgression> map = qProgression.get(quest.getJob().getName());
|
||||
|
||||
if (map != null) {
|
||||
map.clear();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user