1
0
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:
Zrips 2023-05-02 16:47:49 +03:00
parent 5ecb3456a3
commit bc4e9343fc
7 changed files with 269 additions and 231 deletions

View File

@ -912,6 +912,9 @@ public final class Jobs extends JavaPlugin {
} }
private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) { private static void checkDailyQuests(JobsPlayer jPlayer, Job job, ActionInfo info) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
return;
}
if (!job.getQuests().isEmpty()) { if (!job.getQuests().isEmpty()) {
for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) { for (QuestProgression one : jPlayer.getQuestProgressions(job, info.getType())) {
one.processQuest(jPlayer, info); one.processQuest(jPlayer, info);

View File

@ -56,6 +56,10 @@ public class editquests implements Cmd {
Action action = null; Action action = null;
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
}
for (String one : args) { for (String one : args) {
if (page == 0) { if (page == 0) {
try { try {

View File

@ -24,6 +24,12 @@ public class quests implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
}
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
boolean isPlayer = sender instanceof Player; boolean isPlayer = sender instanceof Player;

View File

@ -11,10 +11,18 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import net.Zrips.CMILib.Locale.LC;
public class resetquest implements Cmd { public class resetquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
}
if (args.length != 0 && args.length != 1 && args.length != 2) { if (args.length != 0 && args.length != 1 && args.length != 2) {
Jobs.getCommandManager().sendUsage(sender, "resetquest"); Jobs.getCommandManager().sendUsage(sender, "resetquest");
return true; return true;

View File

@ -11,10 +11,17 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import net.Zrips.CMILib.Locale.LC;
public class resetquesttotal implements Cmd { public class resetquesttotal implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
}
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "resetquesttotal"); Jobs.getCommandManager().sendUsage(sender, "resetquesttotal");
return true; return true;

View File

@ -13,10 +13,16 @@ import com.gamingmesh.jobs.container.Quest;
import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.economy.BufferedEconomy; import com.gamingmesh.jobs.economy.BufferedEconomy;
import net.Zrips.CMILib.Locale.LC;
public class skipquest implements Cmd { public class skipquest implements Cmd {
@Override @Override
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().DailyQuestsEnabled) {
LC.info_FeatureNotEnabled.sendMessage(sender);
return true;
}
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
Jobs.getCommandManager().sendUsage(sender, "skipquest"); Jobs.getCommandManager().sendUsage(sender, "skipquest");
return true; return true;

View File

@ -112,6 +112,7 @@ public class GeneralConfigManager {
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting; payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
public boolean jobsshopenabled; public boolean jobsshopenabled;
public boolean DailyQuestsEnabled;
public ItemStack guiInfoButton; public ItemStack guiInfoButton;
public int InfoButtonSlot = 9; 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"); 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)); 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", 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"); "Any daily quests given before reset will be invalid and new ones will be given out");
ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4); ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4);