mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
Expand Boolean Prompt Values in Conversation API
By: md_5 <md_5@live.com.au>
This commit is contained in:
parent
e58ce0019f
commit
b48983bff8
1 changed files with 2 additions and 1 deletions
|
@ -15,12 +15,13 @@ public abstract class BooleanPrompt extends ValidatingPrompt {
|
|||
|
||||
@Override
|
||||
protected boolean isInputValid(ConversationContext context, String input) {
|
||||
String[] accepted = {"true", "false", "on", "off", "yes", "no"};
|
||||
String[] accepted = {/* Apache values: */"true", "false", "on", "off", "yes", "no",/* Additional values: */ "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"};
|
||||
return ArrayUtils.contains(accepted, input.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true";
|
||||
return acceptValidatedInput(context, BooleanUtils.toBoolean(input));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue