public static interface PlaceholderContext.Builder extends ResettableBuilder<PlaceholderContext,PlaceholderContext.Builder>
PlaceholderText
objects.Modifier and Type | Method and Description |
---|---|
PlaceholderContext |
build()
Builds and returns the placeholder.
|
PlaceholderContext.Builder |
setArgumentString(@Nullable String string)
Sets a string that represents variables for the supplied token.
|
PlaceholderContext.Builder |
setAssociatedObject(@Nullable Object object)
Sets the
Object to use as a source of information
for this PlaceholderText . |
default PlaceholderContext.Builder |
setAssociatedObject(Player player)
|
PlaceholderContext.Builder |
setAssociatedObject(@Nullable Supplier<Object> supplier)
Sets the
Object to use as a source of information
for this PlaceholderText . |
from, reset
default PlaceholderContext.Builder setAssociatedObject(Player player)
player
- The player to associate this text with.PlaceholderContext.getAssociatedObject()
PlaceholderContext.Builder setAssociatedObject(@Nullable Object object)
Object
to use as a source of information
for this PlaceholderText
. If null
, removes this
source.
If you are intending to keep the associated
PlaceholderText
for any period of time and that you wish to
associate a game object with the placeholder, use
setAssociatedObject(Supplier)
instead, supplying a function
that can recreate the object if necessary.
If supplying a Player
, use
setAssociatedObject(Player)
, which will handle creating the
correct supplier for you.
object
- The Object
to associate this text with.PlaceholderContext.getAssociatedObject()
PlaceholderContext.Builder setAssociatedObject(@Nullable Supplier<Object> supplier)
Object
to use as a source of information
for this PlaceholderText
. If null
, removes this source.supplier
- A Supplier
that provides the Object
PlaceholderContext.getAssociatedObject()
PlaceholderContext.Builder setArgumentString(@Nullable String string)
string
- The argument string, may be null to reset to
the default argument stringPlaceholderContext.getArgumentString()
PlaceholderContext build() throws IllegalStateException
PlaceholderText
IllegalStateException
- if the builder has not been completed,
or the associated PlaceholderParser
could not validate the
built PlaceholderText
, if applicable.