public interface NucleusTextTemplate
extends org.spongepowered.api.text.TextRepresentable
TextTemplate that Nucleus uses to create texts from templates.| Modifier and Type | Method and Description |
|---|---|
boolean |
containsTokens()
Returns whether there are tokens to parse.
|
default org.spongepowered.api.text.Text |
getForCommandSource(org.spongepowered.api.command.CommandSource source)
Gets the
Text where the tokens have been parsed from the viewpoint of the supplied CommandSource. |
org.spongepowered.api.text.Text |
getForCommandSource(org.spongepowered.api.command.CommandSource source,
Map<String,Function<org.spongepowered.api.command.CommandSource,Optional<org.spongepowered.api.text.Text>>> tokensArray,
Map<String,Object> variables)
Gets the
Text where the tokens have been parsed from the viewpoint of the supplied CommandSource. |
Optional<org.spongepowered.api.text.Text> |
getPrefix()
Gets the static
Text this message will be prefixed with, if any. |
Optional<org.spongepowered.api.text.Text> |
getSuffix()
Gets the static
Text this message will be suffixed with, if any. |
org.spongepowered.api.text.TextTemplate |
getTextTemplate()
Gets the underlying
TextTemplate |
boolean |
isEmpty()
Whether the text is empty.
|
boolean isEmpty()
true if so.Optional<org.spongepowered.api.text.Text> getPrefix()
Text this message will be prefixed with, if any.Optional<org.spongepowered.api.text.Text> getSuffix()
Text this message will be suffixed with, if any.org.spongepowered.api.text.TextTemplate getTextTemplate()
TextTemplateTextTemplatedefault org.spongepowered.api.text.Text getForCommandSource(org.spongepowered.api.command.CommandSource source)
Text where the tokens have been parsed from the viewpoint of the supplied CommandSource. Any unknown tokens in
the parsed text will be left blank.source - The CommandSource that will influence what is displayed by the tokens.Textboolean containsTokens()
true if there are tokens.org.spongepowered.api.text.Text getForCommandSource(org.spongepowered.api.command.CommandSource source,
@Nullable
Map<String,Function<org.spongepowered.api.command.CommandSource,Optional<org.spongepowered.api.text.Text>>> tokensArray,
@Nullable
Map<String,Object> variables)
Text where the tokens have been parsed from the viewpoint of the supplied CommandSource.
By supplying a token array, these token identifiers act as additional tokens that could be encountered, and will be used above standard
tokens. This is useful for having a token in a specific context, such as "displayfrom", which might only be used in a message, and is
not worth registering in a NucleusMessageTokenService.TokenParser. They must not contain the token start or end delimiters.
The variables are items that might be used by tokens, and is generally best used with your own messages and tokens.
NucleusMessageTokenService.TokenParsers are passed this map.
source - The CommandSource that will influence what is displayed by the tokens.tokensArray - The extra tokens that can be used to parse a text.variables - The variables.Text