Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Bukkit-Patches/0016-Expand-Boolean-Prompt-Values.patch

29 Zeilen
1.4 KiB
Diff

2014-03-09 23:14:45 +01:00
From bf0593497a0cf78104fdec4b477bf18528ab6d60 Mon Sep 17 00:00:00 2001
2013-08-03 11:54:36 +02:00
From: md_5 <md_5@live.com.au>
2013-08-03 11:42:55 +02:00
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
2013-12-18 07:48:18 +01:00
index 3f2c97f..81ef78c 100644
2013-08-03 11:42:55 +02:00
--- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java
+++ b/src/main/java/org/bukkit/conversations/BooleanPrompt.java
2013-12-18 07:48:18 +01:00
@@ -15,12 +15,13 @@ public abstract class BooleanPrompt extends ValidatingPrompt{
2013-08-03 11:42:55 +02:00
@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));
}
--
2013-12-18 07:48:18 +01:00
1.8.3.2
2013-08-03 11:42:55 +02:00