Fixes various bugs in commands
This commit is contained in:
src/main/java/net/knarcraft/paidsigns
@ -15,6 +15,40 @@ public final class TabCompleteHelper {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds tab complete values that contain the typed text
|
||||
*
|
||||
* @param values <p>The values to filter</p>
|
||||
* @param typedText <p>The text the player has started typing</p>
|
||||
* @return <p>The given string values that contain the player's typed text</p>
|
||||
*/
|
||||
public static List<String> filterMatchingContains(List<String> values, String typedText) {
|
||||
List<String> configValues = new ArrayList<>();
|
||||
for (String value : values) {
|
||||
if (value.toLowerCase().contains(typedText.toLowerCase())) {
|
||||
configValues.add(value);
|
||||
}
|
||||
}
|
||||
return configValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds tab complete values that match the start of the typed text
|
||||
*
|
||||
* @param values <p>The values to filter</p>
|
||||
* @param typedText <p>The text the player has started typing</p>
|
||||
* @return <p>The given string values that start with the player's typed text</p>
|
||||
*/
|
||||
public static List<String> filterMatchingStartsWith(List<String> values, String typedText) {
|
||||
List<String> configValues = new ArrayList<>();
|
||||
for (String value : values) {
|
||||
if (value.toLowerCase().startsWith(typedText.toLowerCase())) {
|
||||
configValues.add(value);
|
||||
}
|
||||
}
|
||||
return configValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available boolean values for tab completion
|
||||
*
|
||||
@ -49,7 +83,7 @@ public final class TabCompleteHelper {
|
||||
for (String paidSignName : paidSignNames) {
|
||||
quotedNames.add("\"" + paidSignName + "\"");
|
||||
}
|
||||
return new ArrayList<>(quotedNames);
|
||||
return quotedNames;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user