File tree Expand file tree Collapse file tree
src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/commands/arguments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,23 +12,25 @@ import java.util.concurrent.CompletableFuture
1212/* *
1313 * String argument type class, for commands.
1414 *
15+ * **It probably not work, this must not use by other modules!**
16+ *
17+ * *Will removed in next major version.*
18+ *
1519 * @param array array with accepted values for command.
1620 * @since 2.0.0-SNAPSHOT.1.
1721 */
22+ @Deprecated(" Use custom arguments, this unified argument type and may not work." )
1823class StringArrayArgument (private val array : List <String >) : ArgumentType<String> {
1924 override fun parse (reader : StringReader ): String {
2025 val value = reader.readUnquotedString()
2126 return if (value in array) {
2227 array.find { it == value } ? : value
23- } else {
24- throw IllegalArgumentException (" No value found for name $value in array." )
25- }
28+ } else throw IllegalArgumentException (" No value found for name $value in array." )
2629 }
2730
2831 override fun <S > listSuggestions (
29- context : CommandContext <S >,
30- builder : SuggestionsBuilder
31- ): CompletableFuture <Suggestions > = ISuggestionProvider .suggest(array.sorted(), builder)
32+ context : CommandContext <S >, builder : SuggestionsBuilder
33+ ): CompletableFuture <Suggestions > = ISuggestionProvider .suggest(array, builder)
3234
3335 companion object {
3436 /* *
You can’t perform that action at this time.
0 commit comments