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 theObject
to use as a source of information for thisPlaceholderComponent
.associatedObject
(@Nullable Supplier<@Nullable Object> supplier) Sets theObject
to use as a source of information for thisPlaceholderComponent
.default PlaceholderContext.Builder
associatedObject
(Player player) Sets theObject
to use as a source of information for thisPlaceholderComponent
to the suppliedPlayer
.build()
Builds and returns the placeholder.
-
Method Details
-
associatedObject
Sets theObject
to use as a source of information for thisPlaceholderComponent
to the suppliedPlayer
.- Parameters:
player
- The player to associate this text with.- Returns:
- This, for chaining
- See Also:
-
associatedObject
Sets theObject
to use as a source of information for thisPlaceholderComponent
. Ifnull
, removes this source.If you are intending to keep the associated
PlaceholderComponent
for 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
- TheObject
to associate this text with.- Returns:
- This, for chaining
- See Also:
-
associatedObject
Sets theObject
to 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:
build
in interfaceAbstractBuilder<PlaceholderContext>
- Returns:
- The appropriate
PlaceholderComponent
- Throws:
IllegalStateException
- if the builder has not been completed, or the associatedPlaceholderParser
could not validate the builtPlaceholderComponent
, if applicable.
-