Class Advancement

java.lang.Object
net.minestom.server.advancements.Advancement
Direct Known Subclasses:
AdvancementRoot

public class Advancement extends Object
Represents an advancement located in an AdvancementTab.

All fields are dynamic, changing one will update the advancement in the specific AdvancementTab.

  • Field Details

  • Constructor Details

    • Advancement

      public Advancement(@NotNull @NotNull Component title, @NotNull @NotNull Component description, @NotNull @NotNull Material icon, @NotNull @NotNull FrameType frameType, float x, float y)
    • Advancement

      public Advancement(@NotNull @NotNull Component title, Component description, @NotNull @NotNull ItemStack icon, @NotNull @NotNull FrameType frameType, float x, float y)
    • Advancement

      public Advancement(@NotNull @NotNull Component title, Component description, @NotNull @NotNull ItemStack icon, @NotNull @NotNull FrameType frameType, float x, float y, boolean sendTelemetryData)
  • Method Details

    • isAchieved

      public boolean isAchieved()
      Gets if the advancement is achieved.
      Returns:
      true if the advancement is achieved
    • setAchieved

      public Advancement setAchieved(boolean achieved)
      Makes the advancement achieved.
      Parameters:
      achieved - true to make it achieved
      Returns:
      this advancement
    • getTab

      @Nullable public @Nullable AdvancementTab getTab()
      Gets the advancement tab linked to this advancement.
      Returns:
      the AdvancementTab linked to this advancement, null if not linked to anything yet
    • setTab

      protected void setTab(@NotNull @NotNull AdvancementTab tab)
    • getTitle

      public Component getTitle()
      Gets the title of the advancement.
      Returns:
      the title
    • setTitle

      public void setTitle(@NotNull @NotNull Component title)
      Changes the advancement title.
      Parameters:
      title - the new title
    • getDescription

      @NotNull public @NotNull Component getDescription()
      Gets the description of the advancement.
      Returns:
      the description title
    • setDescription

      public void setDescription(@NotNull @NotNull Component description)
      Changes the description title.
      Parameters:
      description - the new description
    • getIcon

      @NotNull public @NotNull ItemStack getIcon()
      Gets the advancement icon.
      Returns:
      the advancement icon
    • setIcon

      public void setIcon(@NotNull @NotNull ItemStack icon)
      Changes the advancement icon.
      Parameters:
      icon - the new advancement icon
    • hasToast

      public boolean hasToast()
      Gets if this advancement has a toast.
      Returns:
      true if the advancement has a toast
    • showToast

      public Advancement showToast(boolean toast)
      Makes this argument a toast.
      Parameters:
      toast - true to make this advancement a toast
      Returns:
      this advancement
    • isHidden

      public boolean isHidden()
    • setHidden

      public Advancement setHidden(boolean hidden)
    • getFrameType

      @NotNull public @NotNull FrameType getFrameType()
      Gets the advancement frame type.
      Returns:
      this advancement frame type
    • setFrameType

      public void setFrameType(FrameType frameType)
      Changes the advancement frame type.
      Parameters:
      frameType - the new frame type
    • getX

      public float getX()
      Gets the X position of this advancement.
      Returns:
      this advancement X
    • setX

      public void setX(float x)
      Changes this advancement X coordinate.
      Parameters:
      x - the new X coordinate
    • getY

      public float getY()
      Gets the Y position of this advancement.
      Returns:
      this advancement Y
    • setY

      public void setY(float y)
      Changes this advancement Y coordinate.
      Parameters:
      y - the new Y coordinate
    • setBackground

      protected void setBackground(String background)
      Sets the background.

      Only available for AdvancementRoot.

      Parameters:
      background - the new background
    • getIdentifier

      protected String getIdentifier()
      Gets the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later in the AdvancementTab.
      Returns:
      the advancement identifier
    • setIdentifier

      protected void setIdentifier(String identifier)
      Changes the advancement identifier.

      WARNING: unsafe, only used by AdvancementTab to initialize the advancement.

      Parameters:
      identifier - the new advancement identifier
    • getParent

      @Nullable protected @Nullable Advancement getParent()
      Gets the advancement parent.
      Returns:
      the advancement parent, null for AdvancementRoot
    • setParent

      protected void setParent(Advancement parent)
    • toProgressMapping

      @NotNull protected AdvancementsPacket.ProgressMapping toProgressMapping()
    • toDisplayData

      @NotNull protected AdvancementsPacket.DisplayData toDisplayData()
    • toMapping

      @NotNull protected AdvancementsPacket.AdvancementMapping toMapping()
      Converts this advancement to an AdvancementsPacket.AdvancementMapping.
      Returns:
      the mapping of this advancement
    • getUpdatePacket

      protected AdvancementsPacket getUpdatePacket()
      Gets the packet used to add this advancement to the already existing tab.
      Returns:
      the packet to add this advancement
    • update

      protected void update()
      Sends update to all tab viewers if one of the advancement value changes.
    • updateCriteria

      protected void updateCriteria()