mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-08 01:08:23 +01:00
Added sub-command to start or stop the quests for player
This commit is contained in:
parent
3fc2487bfd
commit
97ee33e46e
@ -26,11 +26,11 @@ public class quests implements Cmd {
|
|||||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||||
JobsPlayer jPlayer = null;
|
JobsPlayer jPlayer = null;
|
||||||
|
|
||||||
if (args.length >= 1 && args[0].equals("next")) {
|
if (args.length >= 1 && args[0].equals("next") && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) {
|
||||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
jPlayer.resetQuests();
|
jPlayer.resetQuests();
|
||||||
} else {
|
} else {
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1 && (!(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("start")))) {
|
||||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -52,8 +52,35 @@ public class quests implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.length >= 1) {
|
||||||
|
Boolean stopped = null;
|
||||||
|
String cmd = args.length == 1 ? args[0] : args[1];
|
||||||
|
if (cmd.equalsIgnoreCase("stop")) {
|
||||||
|
stopped = true;
|
||||||
|
} else if (cmd.equalsIgnoreCase("start")) {
|
||||||
|
stopped = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopped != null) {
|
||||||
|
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
||||||
|
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||||
|
for (QuestProgression q : list) {
|
||||||
|
q.getQuest().setStopped(stopped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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")));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
||||||
if (sender instanceof Player) {
|
if (!(sender instanceof Player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
for (JobProgression jobProg : jPlayer.getJobProgression()) {
|
||||||
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||||
|
|
||||||
@ -96,6 +123,7 @@ public class quests implements Cmd {
|
|||||||
for (String one : hoverList) {
|
for (String one : hoverList) {
|
||||||
if (!hover.isEmpty())
|
if (!hover.isEmpty())
|
||||||
hover += "\n";
|
hover += "\n";
|
||||||
|
|
||||||
hover += one;
|
hover += one;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,10 +138,8 @@ public class quests implements Cmd {
|
|||||||
rm.show(sender);
|
rm.show(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
return true;
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
|
||||||
|
|
||||||
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,6 +474,9 @@ public class LanguageManager {
|
|||||||
Jobs.getGCManager().getCommandArgs().put("quests", Arrays.asList("[playername]"));
|
Jobs.getGCManager().getCommandArgs().put("quests", Arrays.asList("[playername]"));
|
||||||
c.get("command.quests.error.noquests", "&cThere are no quests");
|
c.get("command.quests.error.noquests", "&cThere are no quests");
|
||||||
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName] &2(&f[questsDone]&2) &7***********************");
|
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName] &2(&f[questsDone]&2) &7***********************");
|
||||||
|
c.get("command.quests.status.changed", "&2The quests status has been changed to&r %status%");
|
||||||
|
c.get("command.quests.status.started", "&aStarted");
|
||||||
|
c.get("command.quests.status.stopped", "&cStopped");
|
||||||
c.get("command.quests.output.completed", "&2 !Completed!&r ");
|
c.get("command.quests.output.completed", "&2 !Completed!&r ");
|
||||||
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
|
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
|
||||||
c.get("command.quests.output.skip", "&7Click to skip this quest");
|
c.get("command.quests.output.skip", "&7Click to skip this quest");
|
||||||
|
@ -25,6 +25,8 @@ public class Quest {
|
|||||||
private List<String> rewards = new ArrayList<>();
|
private List<String> rewards = new ArrayList<>();
|
||||||
private List<String> area = new ArrayList<>();
|
private List<String> area = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean stopped = false;
|
||||||
|
|
||||||
private HashMap<ActionType, HashMap<String, QuestObjective>> objectives = new HashMap<>();
|
private HashMap<ActionType, HashMap<String, QuestObjective>> objectives = new HashMap<>();
|
||||||
private Set<ActionType> actions = new HashSet<>();
|
private Set<ActionType> actions = new HashSet<>();
|
||||||
|
|
||||||
@ -33,6 +35,14 @@ public class Quest {
|
|||||||
this.job = job;
|
this.job = job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStopped() {
|
||||||
|
return stopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStopped(boolean stopped) {
|
||||||
|
this.stopped = stopped;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getRewardCmds() {
|
public List<String> getRewardCmds() {
|
||||||
return rewardCmds;
|
return rewardCmds;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,10 @@ public class QuestProgression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processQuest(JobsPlayer jPlayer, ActionInfo action) {
|
public void processQuest(JobsPlayer jPlayer, ActionInfo action) {
|
||||||
|
if (quest.isStopped()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!quest.hasAction(action.getType()))
|
if (!quest.hasAction(action.getType()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user