mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 06:58:11 +02:00
Allows us much greater control over the Spigot portion of the code and makes us more "proper" Credit to @Dmck2b for originally passing the idea along a while back
29 lines
1.4 KiB
Diff
29 lines
1.4 KiB
Diff
From 29e4cc1b93abac0afa111892ea0186eeecbce7bf Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@live.com.au>
|
|
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 3f2c97f..81ef78c 100644
|
|
--- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java
|
|
+++ b/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 = {"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.9.1
|
|
|