Files
Purpur/patches/api/0007-Advancement-API.patch
William Blake Galbreath 17368d1aa9 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
12dec20 Bump paerweight to 1.1.7
e33ed89 Get short commit ref using a more proper method
7d6147d Remove now unneeded patch due to paperweight 1.1.7
e72fa41 Update task dependency for includeMappings so the new task isn't skipped
0ad5526 Trim whitspace off of git hash (oops)

Tuinity Changes:
e878ba9 Update paper
2bd2849 Bring back fix codec spam patch
2021-06-27 00:42:39 -05:00

124 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 31 May 2019 21:24:21 -0500
Subject: [PATCH] Advancement API
diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java
index 7c5009974ac8d64d0e738e60cec45acb0d4ca89a..432caadba1b08bb94cdb4ccf552e42400e0db338 100644
--- a/src/main/java/org/bukkit/advancement/Advancement.java
+++ b/src/main/java/org/bukkit/advancement/Advancement.java
@@ -3,6 +3,7 @@ package org.bukkit.advancement;
import java.util.Collection;
import org.bukkit.Keyed;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* Represents an advancement that may be awarded to a player. This class is not
@@ -17,4 +18,12 @@ public interface Advancement extends Keyed {
*/
@NotNull
Collection<String> getCriteria();
+
+ /**
+ * Gets the display properties of this advancement
+ *
+ * @return The display properties
+ */
+ @Nullable
+ AdvancementDisplay getDisplay();
}
diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java
new file mode 100644
index 0000000000000000000000000000000000000000..c2e161e8e14d9949165055b6051708c048e68338
--- /dev/null
+++ b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java
@@ -0,0 +1,53 @@
+package org.bukkit.advancement;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface AdvancementDisplay {
+ /**
+ * Get the title of this advancement
+ *
+ * @return Title text
+ */
+ @NotNull
+ String getTitle();
+
+ /**
+ * Get the description of this advancement
+ *
+ * @return Description text
+ */
+ @NotNull
+ String getDescription();
+
+ /**
+ * Get the frame type of this advancement
+ *
+ * @return Frame type
+ */
+ @NotNull
+ FrameType getFrameType();
+
+ /**
+ * Get if this advancement should be announced in chat when completed
+ *
+ * @return True if should announce when completed
+ */
+ boolean shouldAnnounceChat();
+
+ /**
+ * Set if this advancement should be announced in chat when completed
+ *
+ * @param announceChat True or false
+ *
+ */
+ void shouldAnnounceChat(boolean announceChat);
+
+ /**
+ * Get if this advancement (and all it's children) is hidden from the advancement screen until it has been completed
+ * <p>
+ * This has no effect on root advancements themselves, but will alter their children
+ *
+ * @return True if hidden until completed
+ */
+ boolean isHidden();
+}
diff --git a/src/main/java/org/bukkit/advancement/FrameType.java b/src/main/java/org/bukkit/advancement/FrameType.java
new file mode 100644
index 0000000000000000000000000000000000000000..d1757f3d456ff9efce26ce8baa1d16d896908cc2
--- /dev/null
+++ b/src/main/java/org/bukkit/advancement/FrameType.java
@@ -0,0 +1,27 @@
+package org.bukkit.advancement;
+
+import org.bukkit.ChatColor;
+import org.jetbrains.annotations.NotNull;
+
+public enum FrameType {
+ TASK(ChatColor.GREEN),
+ CHALLENGE(ChatColor.DARK_PURPLE),
+ GOAL(ChatColor.GREEN);
+
+ private final ChatColor color;
+
+ FrameType(ChatColor color) {
+ this.color = color;
+ }
+
+ @NotNull
+ public ChatColor getColor() {
+ return color;
+ }
+
+ @NotNull
+ @Override
+ public String toString() {
+ return "FrameType[name=" + name() + ",color=" + color + "]";
+ }
+}