Fix rewards prompt adding null override, fixes #1782

This commit is contained in:
PikaMug 2021-09-08 13:39:36 -04:00
parent 222313083e
commit 7818d7ae1e
3 changed files with 12 additions and 11 deletions

View File

@ -561,7 +561,7 @@ public class ConditionMainPrompt extends ConditionsEditorNumericPrompt {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
if (plugin.hasLimitedAccess(context.getForWhom()) && !plugin.getSettings().canTrialSave()) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("modeDeny")
.replace("mode", Lang.get("trialMode")));
.replace("<mode>", Lang.get("trialMode")));
return new ConditionMainPrompt(context);
}
plugin.getConditionFactory().saveCondition(context);

View File

@ -843,7 +843,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
if (plugin.hasLimitedAccess(context.getForWhom()) && !plugin.getSettings().canTrialSave()) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("modeDeny")
.replace("mode", Lang.get("trialMode")));
.replace("<mode>", Lang.get("trialMode")));
return new QuestMainPrompt(context);
}
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {

View File

@ -385,17 +385,18 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
@Override
public @NotNull String getPromptText(final ConversationContext context) {
final String input = (String) context.getSessionData(classPrefix + "-override");
if (input != null && !input.equalsIgnoreCase(Lang.get("cancel"))
&& !input.equalsIgnoreCase(Lang.get("clear"))) {
if (input != null && !input.equalsIgnoreCase(Lang.get("cancel"))) {
if (input.equalsIgnoreCase(Lang.get("clear"))) {
context.setSessionData(CK.REW_DETAILS_OVERRIDE, null);
} else {
final LinkedList<String> overrides = new LinkedList<>();
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null) {
overrides.addAll((List<String>) context.getSessionData(CK.REW_DETAILS_OVERRIDE));
} else {
final LinkedList<String> overrides = new LinkedList<>();
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null) {
overrides.addAll((List<String>) context.getSessionData(CK.REW_DETAILS_OVERRIDE));
}
overrides.add(input);
context.setSessionData(CK.REW_DETAILS_OVERRIDE, overrides);
context.setSessionData(classPrefix + "-override", null);
}
overrides.add(input);
context.setSessionData(CK.REW_DETAILS_OVERRIDE, overrides);
context.setSessionData(classPrefix + "-override", null);
}
checkReward(context);