mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +01:00
Option to disable daily quests
This commit is contained in:
parent
5ecb3456a3
commit
bc4e9343fc
@ -912,6 +912,9 @@ public final class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) {
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
return;
|
||||
}
|
||||
if (!job.getQuests().isEmpty()) {
|
||||
for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) {
|
||||
one.processQuest(jPlayer, info);
|
||||
@ -1416,7 +1419,7 @@ public final class Jobs extends JavaPlugin {
|
||||
double expPayment = payment.get(CurrencyType.EXP);
|
||||
|
||||
JobsPrePaymentEvent jobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, payment.get(CurrencyType.MONEY),
|
||||
payment.get(CurrencyType.POINTS), block, ent, victim, info);
|
||||
payment.get(CurrencyType.POINTS), block, ent, victim, info);
|
||||
Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent);
|
||||
// If event is canceled, don't do anything
|
||||
if (jobsPrePaymentEvent.isCancelled())
|
||||
|
@ -55,7 +55,11 @@ public class editquests implements Cmd {
|
||||
int page = 0;
|
||||
|
||||
Action action = null;
|
||||
|
||||
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
}
|
||||
|
||||
for (String one : args) {
|
||||
if (page == 0) {
|
||||
try {
|
||||
|
@ -24,127 +24,133 @@ public class quests implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
|
||||
JobsPlayer jPlayer = null;
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
|
||||
if (args.length >= 1 && !args[0].equalsIgnoreCase("stop") && !args[0].equalsIgnoreCase("start")) {
|
||||
if (!Jobs.hasPermission(sender, "jobs.command.admin.quests", true))
|
||||
return true;
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (isPlayer)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
JobsPlayer jPlayer = null;
|
||||
boolean isPlayer = sender instanceof Player;
|
||||
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "quests");
|
||||
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;
|
||||
|
||||
List<QuestProgression> questProgs = jPlayer.getQuestProgressions();
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
|
||||
} else if (isPlayer)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (questProgs.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.error.noquests"));
|
||||
return true;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
if (args.length >= 1)
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
else
|
||||
Jobs.getCommandManager().sendUsage(sender, "quests");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length >= 1) {
|
||||
Boolean stopped = null;
|
||||
String cmd = args[args.length == 1 ? 0 : 1];
|
||||
List<QuestProgression> questProgs = jPlayer.getQuestProgressions();
|
||||
|
||||
if (cmd.equalsIgnoreCase("stop") && Jobs.hasPermission(sender, "jobs.command.admin.quests.stop", false)) {
|
||||
stopped = true;
|
||||
} else if (cmd.equalsIgnoreCase("start") && Jobs.hasPermission(sender, "jobs.command.admin.quests.start", false)) {
|
||||
stopped = false;
|
||||
}
|
||||
if (questProgs.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.error.noquests"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (stopped != null) {
|
||||
for (QuestProgression q : questProgs) {
|
||||
q.getQuest().setStopped(stopped);
|
||||
}
|
||||
if (args.length >= 1) {
|
||||
Boolean stopped = null;
|
||||
String cmd = args[args.length == 1 ? 0 : 1];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (cmd.equalsIgnoreCase("stop") && Jobs.hasPermission(sender, "jobs.command.admin.quests.stop", false)) {
|
||||
stopped = true;
|
||||
} else if (cmd.equalsIgnoreCase("start") && Jobs.hasPermission(sender, "jobs.command.admin.quests.start", false)) {
|
||||
stopped = false;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
||||
if (stopped != null) {
|
||||
for (QuestProgression q : questProgs) {
|
||||
q.getQuest().setStopped(stopped);
|
||||
}
|
||||
|
||||
for (JobProgression jobProg : jPlayer.progression) {
|
||||
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
for (QuestProgression q : list) {
|
||||
int totalAmountNeeded = q.getTotalAmountNeeded();
|
||||
int totalAmountDone = q.getTotalAmountDone();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests()));
|
||||
|
||||
String progressLine = Jobs.getCommandManager().jobProgressMessage(totalAmountNeeded, totalAmountDone);
|
||||
for (JobProgression jobProg : jPlayer.progression) {
|
||||
List<QuestProgression> list = jPlayer.getQuestProgressions(jobProg.getJob());
|
||||
|
||||
boolean completed = q.isCompleted();
|
||||
for (QuestProgression q : list) {
|
||||
int totalAmountNeeded = q.getTotalAmountNeeded();
|
||||
int totalAmountDone = q.getTotalAmountDone();
|
||||
|
||||
if (completed)
|
||||
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
|
||||
String progressLine = Jobs.getCommandManager().jobProgressMessage(totalAmountNeeded, totalAmountDone);
|
||||
|
||||
Quest quest = q.getQuest();
|
||||
boolean completed = q.isCompleted();
|
||||
|
||||
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", "[progress]",
|
||||
progressLine, "[questName]", quest.getQuestName(), "[done]", totalAmountDone, "[required]", totalAmountNeeded);
|
||||
if (completed)
|
||||
progressLine = Jobs.getLanguage().getMessage("command.quests.output.completed");
|
||||
|
||||
if (!isPlayer) {
|
||||
sender.sendMessage(msg);
|
||||
continue;
|
||||
}
|
||||
Quest quest = q.getQuest();
|
||||
|
||||
RawMessage rm = new RawMessage();
|
||||
String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", "[progress]",
|
||||
progressLine, "[questName]", quest.getQuestName(), "[done]", totalAmountDone, "[required]", totalAmountNeeded);
|
||||
|
||||
String hoverMsg = Jobs.getLanguage().getMessage("command.quests.output.hover");
|
||||
List<String> hoverList = new ArrayList<>();
|
||||
if (!isPlayer) {
|
||||
sender.sendMessage(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String current : hoverMsg.split("\n")) {
|
||||
current = current.replace("[jobName]", jobProg.getJob().getName())
|
||||
.replace("[time]", CMITimeManager.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
|
||||
RawMessage rm = new RawMessage();
|
||||
|
||||
if (current.contains("[desc]")) {
|
||||
hoverList.addAll(quest.getDescription());
|
||||
} else {
|
||||
hoverList.add(current);
|
||||
}
|
||||
}
|
||||
String hoverMsg = Jobs.getLanguage().getMessage("command.quests.output.hover");
|
||||
List<String> hoverList = new ArrayList<>();
|
||||
|
||||
for (java.util.Map<String, QuestObjective> oneAction : quest.getObjectives().values()) {
|
||||
for (Entry<String, QuestObjective> oneObjective : oneAction.entrySet()) {
|
||||
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " +
|
||||
Jobs.getNameTranslatorManager().translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue()
|
||||
.getTargetMeta(), oneObjective.getValue().getTargetName())
|
||||
+ " " + q.getAmountDone(oneObjective.getValue()) + "/"
|
||||
+ oneObjective.getValue().getAmount());
|
||||
}
|
||||
}
|
||||
for (String current : hoverMsg.split("\n")) {
|
||||
current = current.replace("[jobName]", jobProg.getJob().getName())
|
||||
.replace("[time]", CMITimeManager.to24hourShort(q.getValidUntil() - System.currentTimeMillis()));
|
||||
|
||||
String hover = "";
|
||||
for (String one : hoverList) {
|
||||
if (!hover.isEmpty())
|
||||
hover += "\n";
|
||||
if (current.contains("[desc]")) {
|
||||
hoverList.addAll(quest.getDescription());
|
||||
} else {
|
||||
hoverList.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
hover += one;
|
||||
}
|
||||
for (java.util.Map<String, QuestObjective> oneAction : quest.getObjectives().values()) {
|
||||
for (Entry<String, QuestObjective> oneObjective : oneAction.entrySet()) {
|
||||
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " +
|
||||
Jobs.getNameTranslatorManager().translate(oneObjective.getKey(), oneObjective.getValue().getAction(), oneObjective.getValue().getTargetId(), oneObjective.getValue()
|
||||
.getTargetMeta(), oneObjective.getValue().getTargetName())
|
||||
+ " " + q.getAmountDone(oneObjective.getValue()) + "/"
|
||||
+ oneObjective.getValue().getAmount());
|
||||
}
|
||||
}
|
||||
|
||||
if (list.size() < jobProg.getJob().getQuests().size() && Jobs.getGCManager().getDailyQuestsSkips() > jPlayer.getSkippedQuests() && !completed) {
|
||||
if (Jobs.getGCManager().getDailyQuestsSkips() > 0) {
|
||||
hover += "\n" + Jobs.getLanguage().getMessage("command.quests.output.skip");
|
||||
hover += "\n" + Jobs.getLanguage().getMessage("command.quests.output.skips", "[skips]", (Jobs.getGCManager().getDailyQuestsSkips() - jPlayer.getSkippedQuests()));
|
||||
}
|
||||
rm.addText(msg).addHover(hover).addCommand("jobs skipquest " + jobProg.getJob().getName() + " " + quest.getConfigName() + " " + jPlayer.getName());
|
||||
} else
|
||||
rm.addText(msg).addHover(hover);
|
||||
String hover = "";
|
||||
for (String one : hoverList) {
|
||||
if (!hover.isEmpty())
|
||||
hover += "\n";
|
||||
|
||||
rm.show(sender);
|
||||
}
|
||||
}
|
||||
hover += one;
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
return true;
|
||||
if (list.size() < jobProg.getJob().getQuests().size() && Jobs.getGCManager().getDailyQuestsSkips() > jPlayer.getSkippedQuests() && !completed) {
|
||||
if (Jobs.getGCManager().getDailyQuestsSkips() > 0) {
|
||||
hover += "\n" + Jobs.getLanguage().getMessage("command.quests.output.skip");
|
||||
hover += "\n" + Jobs.getLanguage().getMessage("command.quests.output.skips", "[skips]", (Jobs.getGCManager().getDailyQuestsSkips() - jPlayer.getSkippedQuests()));
|
||||
}
|
||||
rm.addText(msg).addHover(hover).addCommand("jobs skipquest " + jobProg.getJob().getName() + " " + quest.getConfigName() + " " + jPlayer.getName());
|
||||
} else
|
||||
rm.addText(msg).addHover(hover);
|
||||
|
||||
rm.show(sender);
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -11,47 +11,55 @@ import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.QuestProgression;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class resetquest implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0 && args.length != 1 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetquest");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 0 && args.length != 1 && args.length != 2) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetquest");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
}
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
}
|
||||
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
List<QuestProgression> quests = jPlayer.getQuestProgressions();
|
||||
List<QuestProgression> quests = jPlayer.getQuestProgressions();
|
||||
|
||||
if (job != null)
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
if (job != null)
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
|
||||
if (quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
return true;
|
||||
}
|
||||
if (quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.resetQuests(quests);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName()));
|
||||
return true;
|
||||
jPlayer.resetQuests(quests);
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getName()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -11,48 +11,55 @@ import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class resetquesttotal implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
|
||||
return true;
|
||||
}
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 0 && args.length != 1) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
|
||||
for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) {
|
||||
pl.getValue().setDoneQuests(0);
|
||||
}
|
||||
Jobs.getJobsDAO().resetDoneQuests();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size()));
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("all")) {
|
||||
for (Entry<UUID, JobsPlayer> pl : Jobs.getPlayerManager().getPlayersCache().entrySet()) {
|
||||
pl.getValue().setDoneQuests(0);
|
||||
}
|
||||
Jobs.getJobsDAO().resetDoneQuests();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", Jobs.getPlayerManager().getPlayersCache().size()));
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
}
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
}
|
||||
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
jPlayer.setDoneQuests(0);
|
||||
jPlayer.setSaved(false);
|
||||
jPlayer.save();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
return true;
|
||||
jPlayer.setDoneQuests(0);
|
||||
jPlayer.setSaved(false);
|
||||
jPlayer.save();
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquesttotal.output.reseted", "%playername%", jPlayer.getName(), "%playerdisplayname%", jPlayer.getDisplayName()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -13,102 +13,108 @@ import com.gamingmesh.jobs.container.Quest;
|
||||
import com.gamingmesh.jobs.container.QuestProgression;
|
||||
import com.gamingmesh.jobs.economy.BufferedEconomy;
|
||||
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
|
||||
public class skipquest implements Cmd {
|
||||
|
||||
@Override
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "skipquest");
|
||||
return true;
|
||||
}
|
||||
if (!Jobs.getGCManager().DailyQuestsEnabled) {
|
||||
LC.info_FeatureNotEnabled.sendMessage(sender);
|
||||
return true;
|
||||
}
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
Jobs.getCommandManager().sendUsage(sender, "skipquest");
|
||||
return true;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
String questName = "";
|
||||
JobsPlayer jPlayer = null;
|
||||
Job job = null;
|
||||
String questName = "";
|
||||
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
if (jPlayer != null)
|
||||
continue;
|
||||
}
|
||||
for (String one : args) {
|
||||
if (job == null) {
|
||||
job = Jobs.getJob(one);
|
||||
if (job != null)
|
||||
continue;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer(one);
|
||||
if (jPlayer != null)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!questName.isEmpty())
|
||||
questName += " ";
|
||||
questName += one;
|
||||
}
|
||||
if (!questName.isEmpty())
|
||||
questName += " ";
|
||||
questName += one;
|
||||
}
|
||||
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
if (jPlayer == null && sender instanceof Player)
|
||||
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
if (jPlayer == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args.length > 0 ? args[0] : ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
List<QuestProgression> quests = jPlayer.getQuestProgressions();
|
||||
List<QuestProgression> quests = jPlayer.getQuestProgressions();
|
||||
|
||||
if (job != null)
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
if (job != null)
|
||||
quests = jPlayer.getQuestProgressions(job);
|
||||
|
||||
if (quests == null || quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
return true;
|
||||
}
|
||||
if (quests == null || quests.isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.noQuests"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Quest old = null;
|
||||
Quest old = null;
|
||||
|
||||
for (QuestProgression one : quests) {
|
||||
Quest q = one.getQuest();
|
||||
for (QuestProgression one : quests) {
|
||||
Quest q = one.getQuest();
|
||||
|
||||
if (q.getQuestName().equalsIgnoreCase(questName) || q.getConfigName().equalsIgnoreCase(questName)) {
|
||||
old = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (q.getQuestName().equalsIgnoreCase(questName) || q.getConfigName().equalsIgnoreCase(questName)) {
|
||||
old = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (old == null) {
|
||||
return false;
|
||||
}
|
||||
if (old == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not skip the completed quests
|
||||
for (QuestProgression q : quests) {
|
||||
if (q.getQuest().getQuestName().equals(old.getQuestName()) && q.isCompleted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Do not skip the completed quests
|
||||
for (QuestProgression q : quests) {
|
||||
if (q.getQuest().getQuestName().equals(old.getQuestName()) && q.isCompleted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Jobs.getGCManager().getDailyQuestsSkips() <= jPlayer.getSkippedQuests()) {
|
||||
return false;
|
||||
}
|
||||
if (Jobs.getGCManager().getDailyQuestsSkips() <= jPlayer.getSkippedQuests()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double amount = Jobs.getGCManager().skipQuestCost;
|
||||
BufferedEconomy econ = Jobs.getEconomy();
|
||||
Player player = jPlayer.getPlayer();
|
||||
double amount = Jobs.getGCManager().skipQuestCost;
|
||||
BufferedEconomy econ = Jobs.getEconomy();
|
||||
Player player = jPlayer.getPlayer();
|
||||
|
||||
if (amount > 0 && player != null) {
|
||||
if (!econ.getEconomy().hasMoney(player, amount)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
||||
return false;
|
||||
}
|
||||
if (amount > 0 && player != null) {
|
||||
if (!econ.getEconomy().hasMoney(player, amount)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("economy.error.nomoney"));
|
||||
return false;
|
||||
}
|
||||
|
||||
econ.getEconomy().withdrawPlayer(player, amount);
|
||||
}
|
||||
econ.getEconomy().withdrawPlayer(player, amount);
|
||||
}
|
||||
|
||||
jPlayer.replaceQuest(old);
|
||||
jPlayer.replaceQuest(old);
|
||||
|
||||
if (player != null)
|
||||
plugin.getServer().dispatchCommand(player, "jobs quests");
|
||||
if (player != null)
|
||||
plugin.getServer().dispatchCommand(player, "jobs quests");
|
||||
|
||||
if (amount > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount));
|
||||
}
|
||||
if (amount > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.skipquest.output.questSkipForCost", "%amount%", amount));
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ public class GeneralConfigManager {
|
||||
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
|
||||
|
||||
public boolean jobsshopenabled;
|
||||
public boolean DailyQuestsEnabled;
|
||||
|
||||
public ItemStack guiInfoButton;
|
||||
public int InfoButtonSlot = 9;
|
||||
@ -422,6 +423,9 @@ public class GeneralConfigManager {
|
||||
c.addComment("broadcast.on-level-up.levels", "For what levels you want to broadcast message? Keep it at 0 if you want for all of them");
|
||||
BroadcastingLevelUpLevels = c.getIntList("broadcast.on-level-up.levels", Arrays.asList(0));
|
||||
|
||||
c.addComment("DailyQuests.Enabled", "Enables or disables daily quests");
|
||||
DailyQuestsEnabled = c.get("DailyQuests.Enabled", true);
|
||||
|
||||
c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests",
|
||||
"Any daily quests given before reset will be invalid and new ones will be given out");
|
||||
ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4);
|
||||
|
Loading…
Reference in New Issue
Block a user