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
-
Constructor Summary
ConstructorDescriptionAdvancement
(@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 Component
Gets the description of the advancement.@NotNull FrameType
Gets the advancement frame type.@NotNull ItemStack
getIcon()
Gets the advancement icon.protected String
Gets the identifier of this advancement, used to register the advancement, use it as a parent and to retrieve it later in theAdvancementTab
.protected @Nullable Advancement
Gets the advancement parent.@Nullable AdvancementTab
getTab()
Gets the advancement tab linked to this advancement.getTitle()
Gets the title of the advancement.protected AdvancementsPacket
Gets the packet used to add this advancement to the already existing tab.float
getX()
Gets the X position of this advancement.float
getY()
Gets the Y position of this advancement.boolean
hasToast()
Gets if this advancement has a toast.boolean
Gets if the advancement is achieved.boolean
isHidden()
setAchieved
(boolean achieved) Makes the advancement achieved.protected void
setBackground
(String background) Sets the background.void
setDescription
(@NotNull Component description) Changes the description title.void
setFrameType
(FrameType frameType) Changes the advancement frame type.setHidden
(boolean hidden) void
Changes the advancement icon.protected void
setIdentifier
(String identifier) Changes the advancement identifier.protected void
setParent
(Advancement parent) protected void
setTab
(@NotNull AdvancementTab tab) void
Changes the advancement title.void
setX
(float x) Changes this advancement X coordinate.void
setY
(float y) Changes this advancement Y coordinate.showToast
(boolean toast) Makes this argument a toast.protected AdvancementsPacket.DisplayData
protected AdvancementsPacket.AdvancementMapping
Converts this advancement to anAdvancementsPacket.AdvancementMapping
.protected AdvancementsPacket.ProgressMapping
protected void
update()
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
AdvancementTab
linked 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
AdvancementTab
to 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()
-