mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: b75eeca0 Boost light task priority to ensure it doesnt hold up chunk loads 3d2bc848 Ensure VillagerTrades doesn't load async - fixes #3495 e470f1ef Add more information to Timing Reports f4a47db6 Improve Thread Pool usage to allow single threads for single cpu servers a4fe910f Fix sounds when using worldedit regen command 70ad51a8 Updated Upstream (Bukkit/CraftBukkit) d7cfa4fa Improve legacy format serialization more
134 lines
3.8 KiB
Diff
134 lines
3.8 KiB
Diff
From a2b02de4ec98e2d8fee3fc9a36f3da00a839c38d 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 Additions
|
|
|
|
---
|
|
.../org/bukkit/advancement/Advancement.java | 9 ++++
|
|
.../advancement/AdvancementDisplay.java | 53 +++++++++++++++++++
|
|
.../org/bukkit/advancement/FrameType.java | 27 ++++++++++
|
|
3 files changed, 89 insertions(+)
|
|
create mode 100644 src/main/java/org/bukkit/advancement/AdvancementDisplay.java
|
|
create mode 100644 src/main/java/org/bukkit/advancement/FrameType.java
|
|
|
|
diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java
|
|
index 7c5009974..432caadba 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 000000000..bca3d112e
|
|
--- /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 shouldAnnounceToChat();
|
|
+
|
|
+ /**
|
|
+ * Set if this advancement should be announced in chat when completed
|
|
+ *
|
|
+ * @param announce True or false
|
|
+ *
|
|
+ */
|
|
+ void setShouldAnnounceToChat(boolean announce);
|
|
+
|
|
+ /**
|
|
+ * 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 000000000..d1757f3d4
|
|
--- /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 + "]";
|
|
+ }
|
|
+}
|
|
--
|
|
2.24.0
|
|
|