Interface PlaceholderContext.Builder
- All Superinterfaces:
AbstractBuilder<PlaceholderContext>,Builder<PlaceholderContext,,PlaceholderContext.Builder> ResettableBuilder<PlaceholderContext,PlaceholderContext.Builder>
- Enclosing interface:
PlaceholderContext
public static interface PlaceholderContext.Builder
extends Builder<PlaceholderContext,PlaceholderContext.Builder>
A builder for
PlaceholderComponent objects.-
Method Summary
Modifier and TypeMethodDescriptionargumentString(@Nullable String string) Sets a string that represents variables for the supplied token.associatedObject(@Nullable Object object) Sets theObjectto use as a source of information for thisPlaceholderComponent.associatedObject(@Nullable Supplier<@Nullable Object> supplier) Sets theObjectto use as a source of information for thisPlaceholderComponent.default PlaceholderContext.BuilderassociatedObject(Player player) Sets theObjectto use as a source of information for thisPlaceholderComponentto the suppliedPlayer.build()Builds and returns the placeholder.
-
Method Details
-
associatedObject
Sets theObjectto use as a source of information for thisPlaceholderComponentto the suppliedPlayer.- Parameters:
player- The player to associate this text with.- Returns:
- This, for chaining
- See Also:
-
associatedObject
Sets theObjectto use as a source of information for thisPlaceholderComponent. Ifnull, removes this source.If you are intending to keep the associated
PlaceholderComponentfor any period of time and that you wish to associate a game object with the placeholder, useassociatedObject(Supplier)instead, supplying a function that can recreate the object if necessary.If supplying a
Player, useassociatedObject(Player), which will handle creating the correct supplier for you.- Parameters:
object- TheObjectto associate this text with.- Returns:
- This, for chaining
- See Also:
-
associatedObject
Sets theObjectto use as a source of information for thisPlaceholderComponent. Ifnull, removes this source. -
argumentString
Sets a string that represents variables for the supplied token. The format of this argument string is dependent on the parser that consumes this string and thus is not prescribed here.- Parameters:
string- The argument string, may be null to reset to the default argument string- Returns:
- This, for chaining
- See Also:
-
build
Builds and returns the placeholder.- Specified by:
buildin interfaceAbstractBuilder<PlaceholderContext>- Returns:
- The appropriate
PlaceholderComponent - Throws:
IllegalStateException- if the builder has not been completed, or the associatedPlaceholderParsercould not validate the builtPlaceholderComponent, if applicable.
-