Fixes tab completion for paid sign names
This commit is contained in:
parent
3eee197fb1
commit
fb9f127307
@ -3,6 +3,7 @@ package net.knarcraft.paidsigns.utility;
|
||||
import net.knarcraft.paidsigns.PaidSigns;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -30,7 +31,11 @@ public final class TabCompleteHelper {
|
||||
* @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) {
|
||||
public static List<String> filterMatchingStartsWith(@NotNull List<String> values, String typedText) {
|
||||
//This little trick makes sure tab-completion works for paid sign names
|
||||
if (!values.isEmpty() && values.get(0).startsWith("\"")) {
|
||||
typedText = "\"" + typedText;
|
||||
}
|
||||
List<String> configValues = new ArrayList<>();
|
||||
for (String value : values) {
|
||||
if (value.toLowerCase().startsWith(typedText.toLowerCase())) {
|
||||
|
Loading…
Reference in New Issue
Block a user