Uses KnarLib for tab-completion filtering
This commit is contained in:
parent
2846100497
commit
fc70b0a582
@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.knarcraft.minstrel.util.TabCompletionHelper.filterMatchingContains;
|
||||
import static net.knarcraft.knarlib.util.TabCompletionHelper.filterMatchingContains;
|
||||
|
||||
public class MinstrelTabCompleter implements TabCompleter {
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
package net.knarcraft.minstrel.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A helper class for tab-completion
|
||||
*/
|
||||
public final class TabCompletionHelper {
|
||||
|
||||
private TabCompletionHelper() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user