Package net.minestom.server.advancements
Class Advancement
java.lang.Object
net.minestom.server.advancements.Advancement
- Direct Known Subclasses:
AdvancementRoot
Represents an advancement located in an
AdvancementTab.
All fields are dynamic, changing one will update the advancement in the specific AdvancementTab.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAdvancement(@NotNull Component title, @NotNull Component description, @NotNull Material icon, @NotNull FrameType frameType, float x, float y) Advancement(@NotNull Component title, Component description, @NotNull ItemStack icon, @NotNull FrameType frameType, float x, float y) Advancement(@NotNull Component title, Component description, @NotNull ItemStack icon, @NotNull FrameType frameType, float x, float y, boolean sendTelemetryData) -
Method Summary
Modifier and TypeMethodDescription@NotNull ComponentGets the description of the advancement.@NotNull FrameTypeGets the advancement frame type.@NotNull ItemStackgetIcon()Gets the advancement icon.protected StringGets the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later in theAdvancementTab.protected @Nullable AdvancementGets the advancement parent.@Nullable AdvancementTabgetTab()Gets the advancement tab linked to this advancement.getTitle()Gets the title of the advancement.protected AdvancementsPacketGets the packet used to add this advancement to the already existing tab.floatgetX()Gets the X position of this advancement.floatgetY()Gets the Y position of this advancement.booleanhasToast()Gets if this advancement has a toast.booleanGets if the advancement is achieved.booleanisHidden()setAchieved(boolean achieved) Makes the advancement achieved.protected voidsetBackground(String background) Sets the background.voidsetDescription(@NotNull Component description) Changes the description title.voidsetFrameType(FrameType frameType) Changes the advancement frame type.setHidden(boolean hidden) voidChanges the advancement icon.protected voidsetIdentifier(String identifier) Changes the advancement identifier.protected voidsetParent(Advancement parent) protected voidsetTab(@NotNull AdvancementTab tab) voidChanges the advancement title.voidsetX(float x) Changes this advancement X coordinate.voidsetY(float y) Changes this advancement Y coordinate.showToast(boolean toast) Makes this argument a toast.protected AdvancementsPacket.DisplayDataprotected AdvancementsPacket.AdvancementMappingConverts this advancement to anAdvancementsPacket.AdvancementMapping.protected AdvancementsPacket.ProgressMappingprotected voidupdate()Sends update to all tab viewers if one of the advancement value changes.protected void
-
Field Details
-
tab
-
-
Constructor Details
-
Advancement
-
Advancement
-
Advancement
-
-
Method Details
-
isAchieved
public boolean isAchieved()Gets if the advancement is achieved.- Returns:
- true if the advancement is achieved
-
setAchieved
Makes the advancement achieved.- Parameters:
achieved- true to make it achieved- Returns:
- this advancement
-
getTab
Gets the advancement tab linked to this advancement.- Returns:
- the
AdvancementTablinked to this advancement, null if not linked to anything yet
-
setTab
-
getTitle
Gets the title of the advancement.- Returns:
- the title
-
setTitle
Changes the advancement title.- Parameters:
title- the new title
-
getDescription
Gets the description of the advancement.- Returns:
- the description title
-
setDescription
Changes the description title.- Parameters:
description- the new description
-
getIcon
Gets the advancement icon.- Returns:
- the advancement icon
-
setIcon
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
Makes this argument a toast.- Parameters:
toast- true to make this advancement a toast- Returns:
- this advancement
-
isHidden
public boolean isHidden() -
setHidden
-
getFrameType
Gets the advancement frame type.- Returns:
- this advancement frame type
-
setFrameType
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
Sets the background.Only available for
AdvancementRoot.- Parameters:
background- the new background
-
getIdentifier
Gets the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later in theAdvancementTab.- Returns:
- the advancement identifier
-
setIdentifier
Changes the advancement identifier.WARNING: unsafe, only used by
AdvancementTabto initialize the advancement.- Parameters:
identifier- the new advancement identifier
-
getParent
Gets the advancement parent.- Returns:
- the advancement parent, null for
AdvancementRoot
-
setParent
-
toProgressMapping
-
toDisplayData
-
toMapping
Converts this advancement to anAdvancementsPacket.AdvancementMapping.- Returns:
- the mapping of this advancement
-
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()
-