Class AdvancementDisplayBuilder<T extends AdvancementDisplayBuilder<T,R>,R extends AdvancementDisplay>
- Direct Known Subclasses:
AdvancementDisplay.Builder
,FancyAdvancementDisplay.Builder
- Since:
- 2.1.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Whether the advancement completion message should be sent on advancement grant.protected @Unmodifiable List
<String> The description of the advancement.protected AdvancementFrameType
The shape of the advancement frame in the advancement GUI.protected final ItemStack
The icon of the advancement in the advancement GUI.protected boolean
Whether the toast notification should be sent on advancement grant.protected final String
The title of the advancement.protected float
The advancement x coordinate.protected float
The advancement y coordinate. -
Constructor Summary
ModifierConstructorDescriptionprotected
AdvancementDisplayBuilder
(@NotNull Material icon, @NotNull String title) Creates a newAdvancementDisplayBuilder
.protected
AdvancementDisplayBuilder
(@NotNull ItemStack icon, @NotNull String title) Creates a newAdvancementDisplayBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionEnables the advancement completion message sent on advancement grant.announceChat
(boolean announceChat) Enables or disables the advancement completion message sent on advancement grant.abstract R
build()
Builds the advancement display.Sets the shape of the advancement frame toAdvancementFrameType.CHALLENGE
.coords
(float x, float y) Sets the x and y coordinates of the advancement in the advancement GUI.coords
(@NotNull CoordAdapter adapter, @NotNull AdvancementKey key) Sets the coordinates of the advancement in the advancement GUI, taking them from the providedCoordAdapter
.description
(@NotNull String... description) Sets the description of the advancement.description
(@NotNull List<String> description) Sets the description of the advancement.boolean
Returns whether the advancement completion message should be sent on advancement grant.boolean
Returns whether the toast notification should be sent on advancement grant.frame
(@NotNull AdvancementFrameType frame) Sets the shape of the advancement frame in the advancement GUI.Gets the description of the advancement.getFrame()
Gets the shape of the advancement frame in the advancement GUI.getIcon()
Gets the icon of the advancement in the advancement GUI.getTitle()
Gets the title of the advancement.float
getX()
Returns the advancement position relative to the x-axis.float
getY()
Returns the advancement position relative to the y-axis.Sets the shape of the advancement frame toAdvancementFrameType.GOAL
.Enables the toast notification sent on advancement grant.showToast
(boolean showToast) Enables or disables the toast notification sent on advancement grant.Sets the shape of the advancement frame toAdvancementFrameType.TASK
.x
(float x) Sets the x and y coordinates of the advancement in the advancement GUI.y
(float y) Sets the y coordinate of the advancement in the advancement GUI.
-
Field Details
-
icon
The icon of the advancement in the advancement GUI. -
title
The title of the advancement. -
description
The description of the advancement. -
frame
The shape of the advancement frame in the advancement GUI. -
showToast
protected boolean showToastWhether the toast notification should be sent on advancement grant. -
announceChat
protected boolean announceChatWhether the advancement completion message should be sent on advancement grant. -
x
protected float xThe advancement x coordinate. Must be >= 0. -
y
protected float yThe advancement y coordinate. Must be >= 0.
-
-
Constructor Details
-
AdvancementDisplayBuilder
protected AdvancementDisplayBuilder(@NotNull @NotNull Material icon, @NotNull @NotNull String title) Creates a newAdvancementDisplayBuilder
.By default, the advancement display returned by
build()
won't show both the toast message and the announcement message in the chat upon advancement completion.The default
frame
isAdvancementFrameType.TASK
.- Parameters:
icon
- The material of the advancement's icon in the advancement GUI.title
- The title of the advancement.
-
AdvancementDisplayBuilder
protected AdvancementDisplayBuilder(@NotNull @NotNull ItemStack icon, @NotNull @NotNull String title) Creates a newAdvancementDisplayBuilder
.By default, the advancement display returned by
build()
won't show both the toast message and the announcement message in the chat upon advancement completion.The default
frame
isAdvancementFrameType.TASK
.- Parameters:
icon
- The advancement's icon in the advancement GUI.title
- The title of the advancement.
-
-
Method Details
-
coords
@NotNull public T coords(@NotNull @NotNull CoordAdapter adapter, @NotNull @NotNull AdvancementKey key) Sets the coordinates of the advancement in the advancement GUI, taking them from the providedCoordAdapter
.- Parameters:
adapter
- TheCoordAdapter
from which the coordinates are taken.key
- TheAdvancementKey
of the advancement.- Returns:
- This builder.
- See Also:
-
coords
Sets the x and y coordinates of the advancement in the advancement GUI.The origin is placed in the upper-left corner of the advancement GUI. The x-axis points to the right (as usual), whereas the y-axis points downward. Thus, the x and y coordinates must be positive.
- Parameters:
x
- The advancement x coordinate. Must be not negative.y
- The advancement y coordinate. Must be not negative.- Returns:
- This builder.
-
x
Sets the x and y coordinates of the advancement in the advancement GUI.The origin is placed in the upper-left corner of the advancement GUI. The x-axis points to the right (as usual).
- Parameters:
x
- The advancement x coordinate. Must be not negative.- Returns:
- This builder.
-
y
Sets the y coordinate of the advancement in the advancement GUI.The origin is placed in the upper-left corner of the advancement GUI. The y-axis points downward.
- Parameters:
y
- The advancement y coordinate. Must be not negative.- Returns:
- This builder.
-
description
Sets the description of the advancement.- Parameters:
description
- The description of the advancement.- Returns:
- This builder.
-
description
Sets the description of the advancement.- Parameters:
description
- The description of the advancement.- Returns:
- This builder.
-
frame
Sets the shape of the advancement frame in the advancement GUI.- Parameters:
frame
- The shape of the advancement frame in the advancement GUI.- Returns:
- This builder.
-
taskFrame
Sets the shape of the advancement frame toAdvancementFrameType.TASK
.- Returns:
- This builder.
-
goalFrame
Sets the shape of the advancement frame toAdvancementFrameType.GOAL
.- Returns:
- This builder.
-
challengeFrame
Sets the shape of the advancement frame toAdvancementFrameType.CHALLENGE
.- Returns:
- This builder.
-
showToast
Enables the toast notification sent on advancement grant.- Returns:
- This builder.
-
showToast
Enables or disables the toast notification sent on advancement grant.- Parameters:
showToast
- Whether to show the toast notification on advancement grant.- Returns:
- This builder.
-
announceChat
Enables the advancement completion message sent on advancement grant.- Returns:
- This builder.
-
announceChat
Enables or disables the advancement completion message sent on advancement grant.- Parameters:
announceChat
- Whether to send the advancement completion message on advancement grant.- Returns:
- This builder.
-
build
Builds the advancement display.- Returns:
- The built advancement display.
-
getIcon
Gets the icon of the advancement in the advancement GUI.- Returns:
- The icon of the advancement in the advancement GUI.
-
getTitle
Gets the title of the advancement.- Returns:
- The title of the advancement.
-
getDescription
Gets the description of the advancement.- Returns:
- The description of the advancement.
-
getFrame
Gets the shape of the advancement frame in the advancement GUI.- Returns:
- The shape of the advancement frame in the advancement GUI.
-
doesShowToast
public boolean doesShowToast()Returns whether the toast notification should be sent on advancement grant.- Returns:
- Whether the toast notification should be sent on advancement grant.
-
doesAnnounceToChat
public boolean doesAnnounceToChat()Returns whether the advancement completion message should be sent on advancement grant.- Returns:
- Whether the advancement completion message should be sent on advancement grant.
-
getX
public float getX()Returns the advancement position relative to the x-axis.- Returns:
- The x coordinate.
-
getY
public float getY()Returns the advancement position relative to the y-axis.- Returns:
- The y coordinate.
-