Class PlayerBadge
java.lang.Object
io.github.thecsdev.tcdcommons.api.badge.PlayerBadge
- Direct Known Subclasses:
ClientPlayerBadge
,SimplePlayerBadge
Represents a badge that can be assigned to a player.
A
Each badge has a constant name and description, which can be retrieved using the
A
PlayerBadge
is similar to an advancement in that it signifies
an achievement or status. However, unlike advancements, badges can be
temporary and are typically used to denote special or unique accomplishments.Each badge has a constant name and description, which can be retrieved using the
getName()
and getDescription()
methods. Whether or not
a badge should be saved with the player's data is determined by the shouldSave()
method.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract net.minecraft.text.Text
Returns the description of the badge.
The returned description should be constant, meaning it should not change over the lifetime of a badge instance.
Must be constant.final Optional<net.minecraft.util.Identifier>
getId()
Returns theIdentifier
of thisPlayerBadge
in accordance with theTRegistries.PLAYER_BADGE
registry.abstract net.minecraft.text.Text
getName()
Returns the display name of the badge.
The returned name should be constant, meaning it should not change over the lifetime of a badge instance.
Must be constant.abstract boolean
Determines if the badge assigned to a player should persist in the player's save data.
When this method returns true, the badge is stored with the player's save data, ensuring its persistence across sessions.
-
Constructor Details
-
PlayerBadge
protected PlayerBadge()
-
-
Method Details
-
getId
Returns theIdentifier
of thisPlayerBadge
in accordance with theTRegistries.PLAYER_BADGE
registry. -
getName
public abstract net.minecraft.text.Text getName()Returns the display name of the badge.
The returned name should be constant, meaning it should not change over the lifetime of a badge instance.
Must be constant. -
getDescription
public abstract net.minecraft.text.Text getDescription()Returns the description of the badge.
The returned description should be constant, meaning it should not change over the lifetime of a badge instance.
Must be constant. -
shouldSave
public abstract boolean shouldSave()Determines if the badge assigned to a player should persist in the player's save data.
When this method returns true, the badge is stored with the player's save data, ensuring its persistence across sessions. If this method returns false, the badge is considered temporary and will not be saved.
The result of this method should be constant for a given badge, as changing the result can lead to inconsistent saving behavior.
Must be constant.
-