Interface PlaceholderContext.Builder
-
- All Superinterfaces:
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 forPlaceholderComponent
objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description PlaceholderContext.Builder
argumentString(@Nullable String string)
Sets a string that represents variables for the supplied token.PlaceholderContext.Builder
associatedObject(@Nullable Object object)
Sets theObject
to use as a source of information for thisPlaceholderComponent
.PlaceholderContext.Builder
associatedObject(@Nullable Supplier<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
.PlaceholderContext
build()
Builds and returns the placeholder.
-
-
-
Method Detail
-
associatedObject
default PlaceholderContext.Builder associatedObject(Player player)
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:
PlaceholderContext.associatedObject()
-
associatedObject
PlaceholderContext.Builder associatedObject(@Nullable Object object)
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:
PlaceholderContext.associatedObject()
-
associatedObject
PlaceholderContext.Builder associatedObject(@Nullable Supplier<Object> supplier)
Sets theObject
to use as a source of information for thisPlaceholderComponent
. Ifnull
, removes this source.- Parameters:
supplier
- ASupplier
that 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:
build
in interfaceBuildable.Builder<PlaceholderContext>
- Returns:
- The appropriate
PlaceholderComponent
- Throws:
IllegalStateException
- if the builder has not been completed, or the associatedPlaceholderParser
could not validate the builtPlaceholderComponent
, if applicable.
-
-