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;
|
JobsPlayer jPlayer = null;
|
||||||
boolean isPlayer = sender instanceof Player;
|
boolean isPlayer = sender instanceof Player;
|
||||||
|
|
||||||
if (args.length >= 1 && isPlayer && args[0].equalsIgnoreCase("next")) {
|
if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) {
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
||||||
jPlayer.resetQuests();
|
return true;
|
||||||
} else {
|
|
||||||
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]);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||||
} else if (isPlayer)
|
} else if (isPlayer)
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
}
|
|
||||||
|
|
||||||
if (jPlayer == null) {
|
if (jPlayer == null) {
|
||||||
if (args.length >= 1)
|
if (args.length >= 1)
|
||||||
@ -69,8 +64,7 @@ public class quests implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.status.changed", "%status%",
|
||||||
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") :
|
stopped ? Jobs.getLanguage().getMessage("command.quests.status.stopped") : Jobs.getLanguage().getMessage("command.quests.status.started")));
|
||||||
Jobs.getLanguage().getMessage("command.quests.status.started")));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1037,10 +1037,10 @@ public class JobsPlayer {
|
|||||||
|
|
||||||
public void resetQuests(List<QuestProgression> quests) {
|
public void resetQuests(List<QuestProgression> quests) {
|
||||||
for (QuestProgression oneQ : quests) {
|
for (QuestProgression oneQ : quests) {
|
||||||
|
oneQ.reset();
|
||||||
Quest quest = oneQ.getQuest();
|
Quest quest = oneQ.getQuest();
|
||||||
|
|
||||||
if (quest != null) {
|
if (quest != null) {
|
||||||
Map<String, QuestProgression> map = qProgression.remove(quest.getJob().getName());
|
Map<String, QuestProgression> map = qProgression.get(quest.getJob().getName());
|
||||||
|
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
map.clear();
|
map.clear();
|
||||||
|
@ -6,6 +6,9 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
import com.gamingmesh.jobs.actions.EnchantActionInfo;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
|
|
||||||
@ -48,6 +51,12 @@ public class QuestProgression {
|
|||||||
return amountNeeded;
|
return amountNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
validUntil = quest.getValidUntil();
|
||||||
|
givenReward = false;
|
||||||
|
done.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public int getTotalAmountDone() {
|
public int getTotalAmountDone() {
|
||||||
int amountDone = 0;
|
int amountDone = 0;
|
||||||
for (Integer one : done.values()) {
|
for (Integer one : done.values()) {
|
||||||
@ -122,10 +131,8 @@ public class QuestProgression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!isCompleted() &&
|
||||||
!isCompleted() &&
|
objective != null) {
|
||||||
objective != null
|
|
||||||
) {
|
|
||||||
Integer old = done.getOrDefault(objective, 0);
|
Integer old = done.getOrDefault(objective, 0);
|
||||||
done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount());
|
done.put(objective, old < objective.getAmount() ? old + 1 : objective.getAmount());
|
||||||
}
|
}
|
||||||
@ -161,10 +168,8 @@ public class QuestProgression {
|
|||||||
return Util.enchantMatchesActionInfo(objectiveKey, (EnchantActionInfo) actionInfo);
|
return Util.enchantMatchesActionInfo(objectiveKey, (EnchantActionInfo) actionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (objectiveKey.equalsIgnoreCase(actionInfo.getNameWithSub()) ||
|
||||||
objectiveKey.equalsIgnoreCase(actionInfo.getNameWithSub()) ||
|
objectiveKey.equalsIgnoreCase(actionInfo.getName()));
|
||||||
objectiveKey.equalsIgnoreCase(actionInfo.getName())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private QuestObjective objectiveForAction(ActionInfo actionInfo) {
|
private QuestObjective objectiveForAction(ActionInfo actionInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user