From b48983bff8d2967b6d1d639f4150d22256fc267d Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 26 Dec 2018 08:00:00 +1100 Subject: [PATCH] Expand Boolean Prompt Values in Conversation API By: md_5 --- .../src/main/java/org/bukkit/conversations/BooleanPrompt.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java index c37d1596ea..d8cf801adf 100644 --- a/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java +++ b/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java @@ -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)); }