mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-10 04:40:28 +01:00
Address inability to clear overrides in editor, part 2. Fixes #1168
This commit is contained in:
parent
aca13cde84
commit
b91574efc3
@ -334,16 +334,20 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
// Check/add newly made override
|
||||
if (context.getSessionData(classPrefix + "-override") != null) {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) != null) {
|
||||
overrides.addAll((List<String>) context.getSessionData(CK.REW_DETAILS_OVERRIDE));
|
||||
final String input = (String) context.getSessionData(classPrefix + "-override");
|
||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cancel"))) {
|
||||
if (input.equalsIgnoreCase(Lang.get("clear"))) {
|
||||
context.setSessionData(CK.REW_DETAILS_OVERRIDE, null);
|
||||
} else {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
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((String) context.getSessionData(classPrefix + "-override"));
|
||||
context.setSessionData(CK.REW_DETAILS_OVERRIDE, overrides);
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
}
|
||||
checkReward(context);
|
||||
|
||||
QuestsEditorPostOpenNumericPromptEvent event = new QuestsEditorPostOpenNumericPromptEvent(context, this);
|
||||
|
@ -390,15 +390,19 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
// Check/add newly made override
|
||||
if (context.getSessionData(classPrefix + "-override") != null) {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
if (context.getSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY) != null) {
|
||||
overrides.addAll((List<String>) context.getSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY));
|
||||
final String input = (String) context.getSessionData(classPrefix + "-override");
|
||||
if (input != null && !input.equalsIgnoreCase(Lang.get("cancel"))) {
|
||||
if (input.equalsIgnoreCase(Lang.get("clear"))) {
|
||||
context.setSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY, null);
|
||||
} else {
|
||||
LinkedList<String> overrides = new LinkedList<String>();
|
||||
if (context.getSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY) != null) {
|
||||
overrides.addAll((List<String>) context.getSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY));
|
||||
}
|
||||
overrides.add(input);
|
||||
context.setSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY, overrides);
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
overrides.add((String) context.getSessionData(classPrefix + "-override"));
|
||||
context.setSessionData(stagePrefix + CK.S_OVERRIDE_DISPLAY, overrides);
|
||||
context.setSessionData(classPrefix + "-override", null);
|
||||
}
|
||||
context.setSessionData(stagePrefix, Boolean.TRUE);
|
||||
checkObjective(context);
|
||||
|
Loading…
Reference in New Issue
Block a user