Add displayName methods for advancements (#8584)
This commit is contained in:
parent
414ea80d74
commit
d98c370fb5
2 changed files with 80 additions and 13 deletions
|
@ -3,13 +3,14 @@ From: syldium <syldium@mailo.com>
|
|||
Date: Fri, 9 Jul 2021 18:49:40 +0200
|
||||
Subject: [PATCH] Add more advancement API
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67341bb70762a2326030abd2548372b92474f544
|
||||
index 0000000000000000000000000000000000000000..19202e17f362fdffca472178b102d1336349590c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
|
||||
@@ -0,0 +1,156 @@
|
||||
@@ -0,0 +1,166 @@
|
||||
+package io.papermc.paper.advancement;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
|
@ -107,6 +108,16 @@ index 0000000000000000000000000000000000000000..67341bb70762a2326030abd2548372b9
|
|||
+ NamespacedKey backgroundPath();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the formatted display name for this display. This
|
||||
+ * is a part of the component that would be shown in chat when a player
|
||||
+ * completes the advancement.
|
||||
+ *
|
||||
+ * @return the display name
|
||||
+ * @see org.bukkit.advancement.Advancement#displayName()
|
||||
+ */
|
||||
+ @NotNull Component displayName();
|
||||
+
|
||||
+ /**
|
||||
+ * Defines how the {@link #icon()} appears in the advancements screen and
|
||||
+ * the color used with the {@link #title() advancement name}.
|
||||
+ */
|
||||
|
@ -167,10 +178,10 @@ index 0000000000000000000000000000000000000000..67341bb70762a2326030abd2548372b9
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..792d5ab90e9252b4f660434f72f004fade14a84c 100644
|
||||
index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..3f6b9e59c2ea38031ca74962e02d710fde61fb1f 100644
|
||||
--- a/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
+++ b/src/main/java/org/bukkit/advancement/Advancement.java
|
||||
@@ -19,13 +19,41 @@ public interface Advancement extends Keyed {
|
||||
@@ -19,13 +19,53 @@ public interface Advancement extends Keyed {
|
||||
@NotNull
|
||||
Collection<String> getCriteria();
|
||||
|
||||
|
@ -189,6 +200,21 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..792d5ab90e9252b4f660434f72f004fa
|
|||
+ 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 a AdvancementDisplay object, or null if not set.
|
||||
+ * @return the display name
|
||||
+ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName()
|
||||
*/
|
||||
- @Nullable
|
||||
- AdvancementDisplay getDisplay();
|
||||
+ @NotNull net.kyori.adventure.text.Component displayName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the parent advancement, if any.
|
||||
+ *
|
||||
+ * @return the parent advancement
|
||||
|
@ -198,12 +224,9 @@ index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..792d5ab90e9252b4f660434f72f004fa
|
|||
+
|
||||
+ /**
|
||||
+ * Gets all the direct children advancements.
|
||||
*
|
||||
- * @return a AdvancementDisplay object, or null if not set.
|
||||
+ *
|
||||
+ * @return the children advancements
|
||||
*/
|
||||
- @Nullable
|
||||
- AdvancementDisplay getDisplay();
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @org.jetbrains.annotations.Unmodifiable
|
||||
+ Collection<Advancement> getChildren();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue