Tweak config setting for new multiplayer option

This commit is contained in:
PikaMug 2021-01-11 01:00:04 -05:00
parent 9415c0c9ad
commit 06ce022d37
6 changed files with 17 additions and 17 deletions

View File

@ -21,7 +21,7 @@ public class Options {
private boolean partiesHandleOfflinePlayers = false;
private long partiesDistance = 0;
private int shareProgressLevel = 1;
private boolean shareOnlySameQuest = true;
private boolean shareSameQuestOnly = true;
public boolean canAllowCommands() {
return allowCommands;
@ -87,11 +87,11 @@ public class Options {
this.shareProgressLevel = shareProgressLevel;
}
public boolean canShareOnlySameQuest() {
return shareOnlySameQuest;
public boolean canShareSameQuestOnly() {
return shareSameQuestOnly;
}
public void setShareOnlySameQuest(final boolean shareOnlySameQuest) {
this.shareOnlySameQuest = shareOnlySameQuest;
public void setShareSameQuestOnly(final boolean shareSameQuestOnly) {
this.shareSameQuestOnly = shareSameQuestOnly;
}
}

View File

@ -285,7 +285,7 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.canUseDungeonsXLPlugin());
context.setSessionData(CK.OPT_USE_PARTIES_PLUGIN, opt.canUsePartiesPlugin());
context.setSessionData(CK.OPT_SHARE_PROGRESS_LEVEL, opt.getShareProgressLevel());
context.setSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST, opt.canShareOnlySameQuest());
context.setSessionData(CK.OPT_SAME_QUEST_ONLY, opt.canShareSameQuestOnly());
// Stages (Objectives)
int index = 1;
for (final Stage stage : q.getStages()) {
@ -949,8 +949,8 @@ public class QuestFactory implements ConversationAbandonedListener {
? (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) : null);
opts.set("share-progress-level", context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) != null
? (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) : null);
opts.set("share-only-same-quest", context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) != null
? (Boolean) context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) : null);
opts.set("same-quest-only", context.getSessionData(CK.OPT_SAME_QUEST_ONLY) != null
? (Boolean) context.getSessionData(CK.OPT_SAME_QUEST_ONLY) : null);
if (opts.getKeys(false).isEmpty()) {
section.set("options", null);
}

View File

@ -3986,7 +3986,7 @@ public class Quester implements Comparable<Quester> {
if (q == null) {
continue;
}
if (quest.getOptions().canShareOnlySameQuest()) {
if (quest.getOptions().canShareSameQuestOnly()) {
if (q.getCurrentStage(quest) != null) {
fun.apply(q, quest);
}

View File

@ -1881,7 +1881,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.getInt("quests." + questKey + ".rewards.parties-experience", -999) != -999) {
rews.setPartiesExperience(config.getInt("quests." + questKey + ".rewards.parties-experience"));
} else {
throw new QuestFormatException("Reward Parties experience is not a number", questKey);
throw new QuestFormatException("Reward parties-experience is not a number", questKey);
}
}
}
@ -2177,8 +2177,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.contains("quests." + questKey + ".options.share-progress-level")) {
opts.setShareProgressLevel(config.getInt("quests." + questKey + ".options.share-progress-level"));
}
if (config.contains("quests." + questKey + ".options.share-only-same-quest")) {
opts.setShareOnlySameQuest(config.getBoolean("quests." + questKey + ".options.share-only-same-quest"));
if (config.contains("quests." + questKey + ".options.same-quest-only")) {
opts.setShareSameQuestOnly(config.getBoolean("quests." + questKey + ".options.same-quest-only"));
}
}

View File

@ -502,13 +502,13 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
}
case 4:
if (context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) == null) {
final boolean defaultOpt = new Options().canShareOnlySameQuest();
if (context.getSessionData(CK.OPT_SAME_QUEST_ONLY) == null) {
final boolean defaultOpt = new Options().canShareSameQuestOnly();
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
} else {
final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST);
final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_SAME_QUEST_ONLY);
return ChatColor.GRAY + "(" + (requireOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(requireOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")";
@ -549,7 +549,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsLevelPrompt(context);
case 4:
tempKey = CK.OPT_SHARE_ONLY_SAME_QUEST;
tempKey = CK.OPT_SAME_QUEST_ONLY;
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsTrueFalsePrompt(context);
case 5:

View File

@ -149,7 +149,7 @@ public class CK {
public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt";
public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt";
public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt";
public static final String OPT_SHARE_ONLY_SAME_QUEST = "shareOnlySameQuestOpt";
public static final String OPT_SAME_QUEST_ONLY = "sameQuestOnlyOpt";
// Actions
public static final String E_OLD_EVENT = "oldEvent";
public static final String E_NAME = "evtName";