@FunctionalInterface public static interface NucleusMessageTokenService.TokenParser
To understand what is returned to the parser, it's worth reminding the implementor what the token that users will use look like:
{{pl:plugin-id:identifier:s}}
Plugins will only ever see the identifier
part of the token. This token can take any form, as chosen by the
plugin, except for the }}
sequence.
Modifier and Type | Method and Description |
---|---|
Optional<org.spongepowered.api.text.Text> |
parse(String tokenInput,
org.spongepowered.api.command.CommandSource source,
Map<String,Object> variables)
Parses a plugin's token and returns
Text , if any. |
@Nonnull Optional<org.spongepowered.api.text.Text> parse(String tokenInput, org.spongepowered.api.command.CommandSource source, Map<String,Object> variables)
Text
, if any.tokenInput
- The identifier for the token.source
- The CommandSource
that will be viewing the output of this token.variables
- A map of variable names to variable objects. Consult documentation for the
variables that might be caused by an event or command.Text
to display, or Optional.empty()
if the token cannot be parsed.