CommandAPI 9.7.0
An API for the command UI introduced in Minecraft 1.13
|
A string reader can be used to progressively read through a string. More...
Public Member Functions | |
String | getString () |
Returns the full input string. More... | |
int | getRemainingLength () |
Returns the remaining length, so the distance from the cursor to the end of the input. More... | |
int | getTotalLength () |
Returns the total length of the input. More... | |
int | getCursor () |
Returns the current cursor position. More... | |
String | getRead () |
Returns the part of the input that was already read. More... | |
String | getRemaining () |
Returns the part of the input that was not yet read. More... | |
boolean | canRead (int length) |
Checks if the reader has enough input to read length more characters. More... | |
boolean | canRead () |
Checks if the reader can read at least one more character. More... | |
char | peek () |
Returns the next character but without consuming it (so the cursor stays at its current position). More... | |
char | peek (int offset) |
Returns the character offset places from the cursor position without consuming it (so the cursor stays at its current position). More... | |
A string reader can be used to progressively read through a string.
To do this the string reader has the concept of a "cursor", which is the current position in the input string. All operations not explicitly stating otherwise, like peek
or canRead
, are relative to the cursor position.
boolean com.mojang.brigadier.ImmutableStringReader.canRead | ( | ) |
Checks if the reader can read at least one more character.
Implemented in com.mojang.brigadier.StringReader.
boolean com.mojang.brigadier.ImmutableStringReader.canRead | ( | int | length | ) |
Checks if the reader has enough input to read length
more characters.
length | the amount of characters to read |
length
more characters Implemented in com.mojang.brigadier.StringReader.
int com.mojang.brigadier.ImmutableStringReader.getCursor | ( | ) |
Returns the current cursor position.
Implemented in com.mojang.brigadier.StringReader.
String com.mojang.brigadier.ImmutableStringReader.getRead | ( | ) |
Returns the part of the input that was already read.
Implemented in com.mojang.brigadier.StringReader.
String com.mojang.brigadier.ImmutableStringReader.getRemaining | ( | ) |
Returns the part of the input that was not yet read.
Implemented in com.mojang.brigadier.StringReader.
int com.mojang.brigadier.ImmutableStringReader.getRemainingLength | ( | ) |
Returns the remaining length, so the distance from the cursor to the end of the input.
Implemented in com.mojang.brigadier.StringReader.
String com.mojang.brigadier.ImmutableStringReader.getString | ( | ) |
Returns the full input string.
Implemented in com.mojang.brigadier.StringReader.
int com.mojang.brigadier.ImmutableStringReader.getTotalLength | ( | ) |
Returns the total length of the input.
Implemented in com.mojang.brigadier.StringReader.
char com.mojang.brigadier.ImmutableStringReader.peek | ( | ) |
Returns the next character but without consuming it (so the cursor stays at its current position).
Implemented in com.mojang.brigadier.StringReader.
char com.mojang.brigadier.ImmutableStringReader.peek | ( | int | offset | ) |
Returns the character offset
places from the cursor position without consuming it (so the cursor stays at its current position).
offset | the offset of the character to peek at |
offset
places from the current cursor position Implemented in com.mojang.brigadier.StringReader.