Class AdvancementDisplayBuilder<T extends AdvancementDisplayBuilder<T,R>,R extends AdvancementDisplay>

java.lang.Object
com.fren_gor.ultimateAdvancementAPI.advancement.display.AdvancementDisplayBuilder<T,R>
Direct Known Subclasses:
AdvancementDisplay.Builder, FancyAdvancementDisplay.Builder

public abstract class AdvancementDisplayBuilder<T extends AdvancementDisplayBuilder<T,R>,R extends AdvancementDisplay> extends Object
A builder for advancement displays.
Since:
2.1.0
  • Field Details

    • icon

      protected final ItemStack icon
      The icon of the advancement in the advancement GUI.
    • title

      protected final String title
      The title of the advancement.
    • description

      protected @Unmodifiable List<String> description
      The description of the advancement.
    • frame

      protected AdvancementFrameType frame
      The shape of the advancement frame in the advancement GUI.
    • showToast

      protected boolean showToast
      Whether the toast notification should be sent on advancement grant.
    • announceChat

      protected boolean announceChat
      Whether the advancement completion message should be sent on advancement grant.
    • x

      protected float x
      The advancement x coordinate. Must be >= 0.
    • y

      protected float y
      The advancement y coordinate. Must be >= 0.
  • Constructor Details

    • AdvancementDisplayBuilder

      protected AdvancementDisplayBuilder(@NotNull @NotNull Material icon, @NotNull @NotNull String title)
      Creates a new AdvancementDisplayBuilder.

      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 is AdvancementFrameType.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 new AdvancementDisplayBuilder.

      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 is AdvancementFrameType.TASK.

      Parameters:
      icon - The advancement's icon in the advancement GUI.
      title - The title of the advancement.
  • Method Details

    • coords

      Sets the coordinates of the advancement in the advancement GUI, taking them from the provided CoordAdapter.
      Parameters:
      adapter - The CoordAdapter from which the coordinates are taken.
      key - The AdvancementKey of the advancement.
      Returns:
      This builder.
      See Also:
    • coords

      @NotNull public T coords(float x, float y)
      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

      @NotNull public T x(float 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

      @NotNull public T y(float 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

      @NotNull public T description(@NotNull @NotNull String... description)
      Sets the description of the advancement.
      Parameters:
      description - The description of the advancement.
      Returns:
      This builder.
    • description

      @NotNull public T description(@NotNull @NotNull List<String> 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

      @NotNull public T taskFrame()
      Sets the shape of the advancement frame to AdvancementFrameType.TASK.
      Returns:
      This builder.
    • goalFrame

      @NotNull public T goalFrame()
      Sets the shape of the advancement frame to AdvancementFrameType.GOAL.
      Returns:
      This builder.
    • challengeFrame

      @NotNull public T challengeFrame()
      Sets the shape of the advancement frame to AdvancementFrameType.CHALLENGE.
      Returns:
      This builder.
    • showToast

      @NotNull public T showToast()
      Enables the toast notification sent on advancement grant.
      Returns:
      This builder.
    • showToast

      public T showToast(boolean 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

      @NotNull public T announceChat()
      Enables the advancement completion message sent on advancement grant.
      Returns:
      This builder.
    • announceChat

      @NotNull public T announceChat(boolean 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

      @NotNull public abstract R build()
      Builds the advancement display.
      Returns:
      The built advancement display.
    • getIcon

      @NotNull public @NotNull ItemStack getIcon()
      Gets the icon of the advancement in the advancement GUI.
      Returns:
      The icon of the advancement in the advancement GUI.
    • getTitle

      @NotNull public @NotNull String getTitle()
      Gets the title of the advancement.
      Returns:
      The title of the advancement.
    • getDescription

      @NotNull public @NotNull List<String> 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.