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.
|
org.spongepowered.api.text.Text |
getBody(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 |
getBody(org.spongepowered.api.command.CommandSource source,
org.spongepowered.api.command.CommandSource sender)
Gets the
Text where the tokens have been parsed from the
viewpoint of the supplied CommandSource . |
org.spongepowered.api.text.Text |
getBody(org.spongepowered.api.command.CommandSource source,
java.util.Map<java.lang.String,java.util.function.Function<org.spongepowered.api.command.CommandSource,java.util.Optional<org.spongepowered.api.text.Text>>> tokensArray)
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)
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,
org.spongepowered.api.command.CommandSource sender)
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,
java.util.Map<java.lang.String,java.util.function.Function<org.spongepowered.api.command.CommandSource,java.util.Optional<org.spongepowered.api.text.Text>>> tokensArray)
Gets the
Text where the tokens have been parsed from the
viewpoint of the supplied CommandSource . |
java.util.Optional<org.spongepowered.api.text.Text> |
getPrefix()
Gets the static
Text this message will be prefixed with, if any. |
java.util.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.java.util.Optional<org.spongepowered.api.text.Text> getPrefix()
Text
this message will be prefixed with, if any.java.util.Optional<org.spongepowered.api.text.Text> getSuffix()
Text
this message will be suffixed with, if any.org.spongepowered.api.text.Text getBody(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.
Unlike getForCommandSource(CommandSource)
, this will
not contain the prefix and suffix in the message.
source
- The CommandSource
that will influence what is
displayed by the tokens.Text
org.spongepowered.api.text.Text getBody(org.spongepowered.api.command.CommandSource source, org.spongepowered.api.command.CommandSource sender)
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.
Unlike getForCommandSource(CommandSource, CommandSource)
,
this will not contain the prefix and suffix in the
message.
source
- The CommandSource
that will influence what is displayed by the tokens.sender
- The CommandSource
that can be considered the {{sender}}
Text
org.spongepowered.api.text.Text getBody(org.spongepowered.api.command.CommandSource source, @Nullable java.util.Map<java.lang.String,java.util.function.Function<org.spongepowered.api.command.CommandSource,java.util.Optional<org.spongepowered.api.text.Text>>> tokensArray)
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 NucleusPlaceholderService
. They must
not contain the token start or end delimiters.
Unlike getForCommandSource(CommandSource, CommandSource)
,
this will not contain the prefix and suffix in the
message.
source
- The CommandSource
that will influence what is displayed by the tokens.tokensArray
- The extra tokens that can be used to parse a text.Text
org.spongepowered.api.text.TextTemplate getTextTemplate()
TextTemplate
TextTemplate
boolean containsTokens()
true
if there are tokens.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.Text
org.spongepowered.api.text.Text getForCommandSource(org.spongepowered.api.command.CommandSource source, org.spongepowered.api.command.CommandSource sender)
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.sender
- The CommandSource
that can be considered the {{sender}}
Text
org.spongepowered.api.text.Text getForCommandSource(org.spongepowered.api.command.CommandSource source, @Nullable java.util.Map<java.lang.String,java.util.function.Function<org.spongepowered.api.command.CommandSource,java.util.Optional<org.spongepowered.api.text.Text>>> tokensArray)
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 NucleusPlaceholderService
. They must
not contain the token start or end delimiters.
source
- The CommandSource
that will influence what is displayed by the tokens.tokensArray
- The extra tokens that can be used to parse a text.Text