Add more advancement API

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
syldium
2021-07-09 18:49:40 +02:00
parent 4bfca492a5
commit 9ae3b87be7
4 changed files with 210 additions and 5 deletions

View File

@@ -27,13 +27,53 @@ public interface Advancement extends Keyed {
@NotNull
AdvancementRequirements getRequirements();
// Paper start
/**
* Returns the display information for this advancement.
* Get the display info of this advancement.
* <p>
* Will be {@code null} when totally hidden, for example with crafting
* recipes.
*
* This includes it's name, description and other visible tags.
*
* @return a AdvancementDisplay object, or null if not set.
* @return the display info
*/
@Nullable
AdvancementDisplay getDisplay();
io.papermc.paper.advancement.AdvancementDisplay getDisplay();
/**
* Gets the formatted display name for this display. This
* is part of the component that would be shown in chat when a player
* completes the advancement. Will return the same as
* {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an
* {@link io.papermc.paper.advancement.AdvancementDisplay} is present.
*
* @return the display name
* @see io.papermc.paper.advancement.AdvancementDisplay#displayName()
*/
@NotNull net.kyori.adventure.text.Component displayName();
/**
* Gets the parent advancement, if any.
*
* @return the parent advancement
*/
@Nullable
Advancement getParent();
/**
* Gets all the direct children advancements.
*
* @return the children advancements
*/
@NotNull
@org.jetbrains.annotations.Unmodifiable
Collection<Advancement> getChildren();
/**
* Gets the root advancement of the tree this is located in.
*
* @return the root advancement
*/
@NotNull
Advancement getRoot();
// Paper end
}

View File

@@ -5,7 +5,10 @@ import org.jetbrains.annotations.NotNull;
/**
* Holds information about how the advancement is displayed by the game.
*
* @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay}
*/
@Deprecated(forRemoval = true) // Paper
public interface AdvancementDisplay {
/**

View File

@@ -8,7 +8,9 @@ import org.jetbrains.annotations.NotNull;
*
* This enum contains information about these types and how they are
* represented.
* @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay.Frame}
*/
@Deprecated(forRemoval = true)
public enum AdvancementDisplayType {
/**