From fb9f127307af57c4eff305a64eac90a6bb7b87eb Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 6 Aug 2022 17:21:19 +0200 Subject: [PATCH] Fixes tab completion for paid sign names --- .../net/knarcraft/paidsigns/utility/TabCompleteHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/paidsigns/utility/TabCompleteHelper.java b/src/main/java/net/knarcraft/paidsigns/utility/TabCompleteHelper.java index ab9011b..a294d80 100644 --- a/src/main/java/net/knarcraft/paidsigns/utility/TabCompleteHelper.java +++ b/src/main/java/net/knarcraft/paidsigns/utility/TabCompleteHelper.java @@ -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

The text the player has started typing

* @return

The given string values that start with the player's typed text

*/ - public static List filterMatchingStartsWith(List values, String typedText) { + public static List filterMatchingStartsWith(@NotNull List 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 configValues = new ArrayList<>(); for (String value : values) { if (value.toLowerCase().startsWith(typedText.toLowerCase())) {