diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index f37a750d..abe5c32a 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -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()) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java index e1099090..4a2acfb0 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -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 { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index d43557b2..f53d5dc6 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -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 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 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 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 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 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 hoverList = new ArrayList<>(); - for (java.util.Map oneAction : quest.getObjectives().values()) { - for (Entry 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 oneAction : quest.getObjectives().values()) { + for (Entry 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; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java index 75c1e0b0..d3fee368 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java @@ -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 quests = jPlayer.getQuestProgressions(); + List 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; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java index daaf28e4..6157158d 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquesttotal.java @@ -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 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 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; } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java index 05ac85b0..427c4670 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java @@ -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 quests = jPlayer.getQuestProgressions(); + List 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; } } diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 90180c64..a4a98967 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -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);