public interface RichSuggestionsBuilder
This is designed as an abstraction over Brigadier, while still allowing legacy string-only suggestions.
| Modifier and Type | Method and Description |
|---|---|
void |
add(@NotNull RichSuggestionsBuilder other)
Adds all suggestions from another builder instance.
|
@NotNull RichSuggestionsBuilder |
createOffset(int start)
Creates a new builder view with the given replacement offset.
|
default void |
flushLegacy()
Flushes legacy suggestions into this builder.
|
@NotNull java.lang.String |
input()
Returns the full input used for suggestion generation.
|
@NotNull SuggestionsBuilder |
legacyView()
Returns the legacy string-only builder view.
|
@NotNull java.lang.String |
remaining()
Returns the remaining input segment from
start(). |
@NotNull java.lang.String |
remainingLowerCase()
Returns the lowercase remaining input segment from
start(). |
@NotNull RichSuggestionsBuilder |
restart()
Creates a new builder view that restarts at this builder's start offset.
|
default void |
setFilter(@Nullable java.util.function.Predicate<java.lang.String> filter)
Sets the suggestion filter.
|
int |
start()
Returns the start offset where suggestions should replace text.
|
void |
suggest(int value)
Adds an integer suggestion.
|
default void |
suggest(int value,
@Nullable SuggestionTooltip tooltip)
Adds an integer suggestion with optional tooltip metadata.
|
void |
suggest(@NotNull java.lang.String text)
Adds a string suggestion.
|
default void |
suggest(@NotNull java.lang.String text,
@Nullable SuggestionTooltip tooltip)
Adds a string suggestion with optional tooltip metadata.
|
default boolean |
testFilter(@NotNull java.lang.String suggestion)
Tests whether a suggestion passes the current filter.
|
@NotNull @NotNull java.lang.String input()
int start()
@NotNull @NotNull java.lang.String remaining()
start().@NotNull @NotNull java.lang.String remainingLowerCase()
start().void suggest(@NotNull
@NotNull java.lang.String text)
text - the suggested textdefault void suggest(@NotNull
@NotNull java.lang.String text,
@Nullable
@Nullable SuggestionTooltip tooltip)
text - the suggested texttooltip - the tooltip metadata, or nullvoid suggest(int value)
value - the suggested valuedefault void suggest(int value,
@Nullable
@Nullable SuggestionTooltip tooltip)
value - the suggested valuetooltip - the tooltip metadata, or nullvoid add(@NotNull
@NotNull RichSuggestionsBuilder other)
other - the builder to merge from@NotNull @NotNull RichSuggestionsBuilder createOffset(int start)
start - the replacement start offset@NotNull @NotNull RichSuggestionsBuilder restart()
@NotNull @NotNull SuggestionsBuilder legacyView()
default boolean testFilter(@NotNull
@NotNull java.lang.String suggestion)
suggestion - the suggestion to testdefault void setFilter(@Nullable
@Nullable java.util.function.Predicate<java.lang.String> filter)
Only suggestions that pass this filter will be included.
filter - the filter predicate, or null to accept all suggestionsdefault void flushLegacy()