CommandAPI 9.7.0
An API for the command UI introduced in Minecraft 1.13
|
A Suggestion
that suggests an integer.
More...
Public Member Functions | |
IntegerSuggestion (final StringRange range, final int value) | |
Creates a new IntegerSuggestion that covers a given range and suggests a given int value. More... | |
IntegerSuggestion (final StringRange range, final int value, final Message tooltip) | |
Creates a new IntegerSuggestion that covers a given range and has a given int value and tooltip. More... | |
int | getValue () |
Returns the underlying integer suggestion value. More... | |
boolean | equals (final Object o) |
int | hashCode () |
String | toString () |
int | compareTo (final Suggestion o) |
Compares the getText() of this suggestion to the getText() of the passed suggestion. More... | |
int | compareToIgnoreCase (final Suggestion b) |
Compares the getText() of this suggestion to the getText() of the passed suggestion, ignoring case. More... | |
StringRange | getRange () |
Returns the range in the input string this suggestion is applicable in. More... | |
String | getText () |
Returns the text this suggestion suggests. More... | |
Message | getTooltip () |
Returns the tooltip with some explanatory message for the user. More... | |
String | apply (final String input) |
Applies the suggestion to the input. More... | |
Suggestion | expand (final String command, final StringRange range) |
Expands this suggestion by changing the range to the passed one and filling everything that lies outside getText() with characters from the passed command. More... | |
A Suggestion
that suggests an integer.
The method compareTo(Suggestion)
orders IntegerSuggestions in ascending order, but when compared with other suggestion types orders them based on the textual representation of the integer value.
com.mojang.brigadier.suggestion.IntegerSuggestion.IntegerSuggestion | ( | final StringRange | range, |
final int | value | ||
) |
Creates a new IntegerSuggestion that covers a given range and suggests a given int value.
range | the range it covers in the input |
value | the integer value to suggest |
com.mojang.brigadier.suggestion.IntegerSuggestion.IntegerSuggestion | ( | final StringRange | range, |
final int | value, | ||
final Message | tooltip | ||
) |
Creates a new IntegerSuggestion that covers a given range and has a given int value and tooltip.
range | the range it covers in the input |
value | the integer value to suggest |
tooltip | a tooltip message to show the user |
|
inherited |
Applies the suggestion to the input.
This method will replace or insert the getText()
into the passed input string.
An Example with the text fizz
:
buzz
, range 0-4 fizz
buzz
, range 0-0 fizzbuzz
buzz
, range 4-4 buzzfizz
input | the input string to apply it to |
StringIndexOutOfBoundsException | if the range is not contained in the input string |
int com.mojang.brigadier.suggestion.IntegerSuggestion.compareTo | ( | final Suggestion | o | ) |
Compares the getText()
of this suggestion to the getText()
of the passed suggestion.
This method is case sensitive, see compareToIgnoreCase(Suggestion)
if you need it to the ignore the case.
o | the suggestion to compare it to |
Reimplemented from com.mojang.brigadier.suggestion.Suggestion.
int com.mojang.brigadier.suggestion.IntegerSuggestion.compareToIgnoreCase | ( | final Suggestion | b | ) |
Compares the getText()
of this suggestion to the getText()
of the passed suggestion, ignoring case.
b | the suggestion to compare it to |
Reimplemented from com.mojang.brigadier.suggestion.Suggestion.
boolean com.mojang.brigadier.suggestion.IntegerSuggestion.equals | ( | final Object | o | ) |
Reimplemented from com.mojang.brigadier.suggestion.Suggestion.
|
inherited |
Expands this suggestion by changing the range to the passed one and filling everything that lies outside getText()
with characters from the passed command.
Examples with text = ----
and range = 0
and the text to apply it to as abcdefghi
:
expand("123", StringRange.at(0)
: ----abcdefghi
, as the ranges matched and so nothing was changed expand("123", StringRange.at(1)
: a----1bcdefghi
, as the passed range (1) was taken and one character from the command was used to fill up the index 1, as the range of the original suggestion was 0 expand("123", StringRange.between(1, 3)
: a----123defghi
, as the passed range (1,3) was taken and 3 characters from the command were used to fill up the indices 1, 2 and 3, as the range of the original suggestion was 0. It is then inserted after the first character in the text it is applied to (after the a) and replaces everything that lies in its interval (bc). command | the command to fill the range up with |
range | the range to widen it to |
|
inherited |
Returns the range in the input string this suggestion is applicable in.
|
inherited |
Returns the text this suggestion suggests.
|
inherited |
Returns the tooltip with some explanatory message for the user.
int com.mojang.brigadier.suggestion.IntegerSuggestion.getValue | ( | ) |
Returns the underlying integer suggestion value.
int com.mojang.brigadier.suggestion.IntegerSuggestion.hashCode | ( | ) |
Reimplemented from com.mojang.brigadier.suggestion.Suggestion.
String com.mojang.brigadier.suggestion.IntegerSuggestion.toString | ( | ) |
Reimplemented from com.mojang.brigadier.suggestion.Suggestion.