From 5a237b8e57c66aed51edeecd1974c07f158a66f6 Mon Sep 17 00:00:00 2001 From: Alex Bennett Date: Sat, 3 Aug 2013 19:42:55 +1000 Subject: [PATCH] Expand Boolean Prompt Values --- .../0017-Expand-Boolean-Prompt-Values.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Bukkit-Patches/0017-Expand-Boolean-Prompt-Values.patch diff --git a/Bukkit-Patches/0017-Expand-Boolean-Prompt-Values.patch b/Bukkit-Patches/0017-Expand-Boolean-Prompt-Values.patch new file mode 100644 index 0000000000..86f8471280 --- /dev/null +++ b/Bukkit-Patches/0017-Expand-Boolean-Prompt-Values.patch @@ -0,0 +1,28 @@ +From 358d6030f9f6bfa6f0d79d2166bfe37067ceea71 Mon Sep 17 00:00:00 2001 +From: Alex Bennett +Date: Sat, 3 Aug 2013 19:42:16 +1000 +Subject: [PATCH] Expand Boolean Prompt Values + + +diff --git a/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/src/main/java/org/bukkit/conversations/BooleanPrompt.java +index 3bfd733..cd29a0c 100644 +--- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java ++++ b/src/main/java/org/bukkit/conversations/BooleanPrompt.java +@@ -14,12 +14,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 = {"true", "false", "on", "off", "yes", "no" /* Spigot: */, "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"}; // Spigot + 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"; // Spigot + return acceptValidatedInput(context, BooleanUtils.toBoolean(input)); + } + +-- +1.8.1.2 +