Interface PlaceholderContext
public interface PlaceholderContext
Contains the context that a
PlaceholderParser
can use to determine
what to display.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A builder forPlaceholderComponent
objects. -
Method Summary
Modifier and TypeMethodDescriptionThe variable string passed to this token to provide contextual information.If provided, theObject
which to pull information from when building the placeholder text.static PlaceholderContext.Builder
builder()
Creates aPlaceholderContext
for aPlaceholderParser
to consume.
-
Method Details
-
builder
Creates aPlaceholderContext
for aPlaceholderParser
to consume.- Returns:
- The builder.
-
associatedObject
If provided, theObject
which to pull information from when building the placeholder text.Examples of how this might affect a placeholder are:
- For a "name" placeholder that prints out the source's name, the name would be selected from this source.
- For a "current world" placeholder that returns a player's current world, this would pull the name of that current world from the player.
It is important to note that the associated context does not necessarily have to be the sender/invoker of a message, nor does it have to be the recipient. The source is selected by the context of builder. It is up to plugins that use such placeholders to be aware of the context of which the placeholder is used.
PlaceholderParser
s should make no assumption about the origin of the context.If an invalid
Object
is provided for the context of the placeholder, then the associatedPlaceholderParser
must return aComponent.empty()
.- Returns:
- The associated
Object
, if any.
-
argumentString
The variable string passed to this token to provide contextual information.- Returns:
- The argument, if any
-