Interface PlaceholderContext.Builder
-
- All Superinterfaces:
AbstractBuilder<PlaceholderContext>,Buildable.Builder<PlaceholderContext>,Builder<PlaceholderContext,PlaceholderContext.Builder>,ResettableBuilder<PlaceholderContext,PlaceholderContext.Builder>
- Enclosing interface:
- PlaceholderContext
public static interface PlaceholderContext.Builder extends Builder<PlaceholderContext,PlaceholderContext.Builder>
A builder forPlaceholderComponentobjects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PlaceholderContext.BuilderargumentString(@Nullable String string)Sets a string that represents variables for the supplied token.PlaceholderContext.BuilderassociatedObject(@Nullable Object object)Sets theObjectto use as a source of information for thisPlaceholderComponent.PlaceholderContext.BuilderassociatedObject(@Nullable Supplier<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.PlaceholderContextbuild()Builds and returns the placeholder.
-
-
-
Method Detail
-
associatedObject
default PlaceholderContext.Builder associatedObject(Player player)
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:
PlaceholderContext.associatedObject()
-
associatedObject
PlaceholderContext.Builder associatedObject(@Nullable Object object)
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:
PlaceholderContext.associatedObject()
-
associatedObject
PlaceholderContext.Builder associatedObject(@Nullable Supplier<Object> supplier)
Sets theObjectto use as a source of information for thisPlaceholderComponent. Ifnull, removes this source.- Parameters:
supplier- ASupplierthat provides theObject- Returns:
- This, for chaining
- See Also:
PlaceholderContext.associatedObject()
-
argumentString
PlaceholderContext.Builder argumentString(@Nullable String string)
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:
PlaceholderContext.argumentString()
-
build
PlaceholderContext build() throws IllegalStateException
Builds and returns the placeholder.- Specified by:
buildin interfaceAbstractBuilder<PlaceholderContext>- Specified by:
buildin interfaceBuildable.Builder<PlaceholderContext>- Returns:
- The appropriate
PlaceholderComponent - Throws:
IllegalStateException- if the builder has not been completed, or the associatedPlaceholderParsercould not validate the builtPlaceholderComponent, if applicable.
-
-