@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:
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
@Nonnull Optional<Text> parse(String tokenInput, CommandSource source, Map<String,Object> variables)
Text, if any.
tokenInput- The identifier for the token.
CommandSourcethat 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.
Textto display, or
Optional.empty()if the token cannot be parsed.