Text Replacements
The TextReplacements
enum provides a set of named text replacements that can be used to generate dynamic text in a message. These replacements can be used in chat messages, command responses, or any other text-based content that needs to be customized for a specific player or situation.
Constant names should be pretty self-explanatory. If not, you can check their individual documentation.
Here are some examples:
%player_name% has used %totem_uses% so far.
%player_name% is on hardcore mode!
This enum also provides a helper method, .provideDefaults, that takes a player object and a list of TextReplacements and returns a hashmap containing the default values for the specified replacements. This can be used to quickly generate replacement values for a given player without needing to manually retrieve their name and totem usage.
Entries
Provides either a TranslatableComponent via the provideComponentDefaults method or an attempt at a translated string version via provideStringDefaults
A stand-in for all possible replacements. May not be used for actual replacements, but rather in conjunction with provideStringDefaults or provideComponentDefaults.
Functions
Turns the constant name into it's corresponding text-placeholder. (Example: PLAYER_NAME → %player_name%
)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.