2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Connor Linfoot <connorlinfoot@me.com>
|
|
|
|
Date: Sun, 16 May 2021 15:07:34 +0100
|
|
|
|
Subject: [PATCH] Add basic Datapack API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000000000000000000000000000000000..7b2ab0be10a21e0496ad1d485ff8cb2c0b92a2cb
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
|
|
|
@@ -0,0 +1,32 @@
|
|
|
|
+package io.papermc.paper.datapack;
|
|
|
|
+
|
|
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
|
|
+
|
|
|
|
+public interface Datapack {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return the name of the pack
|
|
|
|
+ */
|
|
|
|
+ @NonNull
|
|
|
|
+ String getName();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return the compatibility of the pack
|
|
|
|
+ */
|
|
|
|
+ @NonNull
|
|
|
|
+ Compatibility getCompatibility();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return whether or not the pack is currently enabled
|
|
|
|
+ */
|
|
|
|
+ boolean isEnabled();
|
|
|
|
+
|
|
|
|
+ void setEnabled(boolean enabled);
|
|
|
|
+
|
|
|
|
+ enum Compatibility {
|
|
|
|
+ TOO_OLD,
|
|
|
|
+ TOO_NEW,
|
|
|
|
+ COMPATIBLE,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f70d08b2a2
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
|
|
|
@@ -0,0 +1,21 @@
|
|
|
|
+package io.papermc.paper.datapack;
|
|
|
|
+
|
|
|
|
+import org.checkerframework.checker.nullness.qual.NonNull;
|
|
|
|
+
|
|
|
|
+import java.util.Collection;
|
|
|
|
+
|
|
|
|
+public interface DatapackManager {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return all the packs known to the server
|
|
|
|
+ */
|
|
|
|
+ @NonNull
|
|
|
|
+ Collection<Datapack> getPacks();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return all the packs which are currently enabled
|
|
|
|
+ */
|
|
|
|
+ @NonNull
|
|
|
|
+ Collection<Datapack> getEnabledPacks();
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
2024-05-10 12:52:03 +02:00
|
|
|
index 8fd1de659777595d9d8198e7ee638ad5500a6317..e62d46629305a268906cd2cd5d5977d063c2f484 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2024-04-23 19:02:08 +02:00
|
|
|
@@ -330,9 +330,11 @@ public final class Bukkit {
|
2023-06-06 11:09:19 +02:00
|
|
|
/**
|
|
|
|
* Get the DataPack Manager.
|
|
|
|
*
|
|
|
|
+ * @deprecated use {@link #getDatapackManager()}
|
|
|
|
* @return the manager
|
|
|
|
*/
|
|
|
|
@NotNull
|
|
|
|
+ @Deprecated(forRemoval = true)
|
|
|
|
public static DataPackManager getDataPackManager() {
|
|
|
|
return server.getDataPackManager();
|
|
|
|
}
|
2024-05-04 20:22:35 +02:00
|
|
|
@@ -2588,6 +2590,14 @@ public final class Bukkit {
|
2021-06-11 14:02:28 +02:00
|
|
|
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
|
|
|
return server.getMobGoals();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return the datapack manager
|
|
|
|
+ */
|
|
|
|
+ @NotNull
|
|
|
|
+ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
|
|
|
|
+ return server.getDatapackManager();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
2024-05-10 12:52:03 +02:00
|
|
|
index e1ab2090c1b219f12af382079907e440e9cf4379..e3a494b9d3727973d225de3042da93594f36ca12 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2024-04-23 19:02:08 +02:00
|
|
|
@@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2023-06-06 11:09:19 +02:00
|
|
|
/**
|
|
|
|
* Get the DataPack Manager.
|
|
|
|
*
|
|
|
|
+ * @deprecated use {@link #getDatapackManager()}
|
|
|
|
* @return the manager
|
|
|
|
*/
|
|
|
|
@NotNull
|
|
|
|
+ @Deprecated(forRemoval = true) // Paper
|
|
|
|
public DataPackManager getDataPackManager();
|
|
|
|
|
|
|
|
/**
|
2024-05-10 12:52:03 +02:00
|
|
|
@@ -2256,5 +2258,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
|
|
|
@NotNull
|
|
|
|
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return the datapack manager
|
|
|
|
+ */
|
|
|
|
+ @NotNull
|
|
|
|
+ io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
|
|
|
// Paper end
|
|
|
|
}
|
2023-06-06 11:09:19 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/packs/DataPack.java b/src/main/java/org/bukkit/packs/DataPack.java
|
2023-09-29 02:28:26 +02:00
|
|
|
index 3d5af25a399589f1bdf95b77f584ae0ae5c26f02..ab512c7ee9d2442055b719d02d0d0ecc7ea8d992 100644
|
2023-06-06 11:09:19 +02:00
|
|
|
--- a/src/main/java/org/bukkit/packs/DataPack.java
|
|
|
|
+++ b/src/main/java/org/bukkit/packs/DataPack.java
|
2023-09-29 02:28:26 +02:00
|
|
|
@@ -10,8 +10,10 @@ import org.jetbrains.annotations.NotNull;
|
2023-06-06 11:09:19 +02:00
|
|
|
* Represents a data pack.
|
2023-09-29 02:28:26 +02:00
|
|
|
*
|
|
|
|
* @see <a href="https://minecraft.wiki/w/Data_pack">Minecraft wiki</a>
|
2023-06-06 11:09:19 +02:00
|
|
|
+ * @deprecated use {@link io.papermc.paper.datapack.Datapack}
|
|
|
|
*/
|
|
|
|
@ApiStatus.Experimental
|
|
|
|
+@Deprecated(forRemoval = true) // Paper
|
|
|
|
public interface DataPack extends Keyed {
|
|
|
|
|
|
|
|
/**
|
|
|
|
diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java
|
|
|
|
index d7fb6310e6b1050c496d748388310bc6f8d78e23..2cd505046277febe010e9476539b064321d8b2ec 100644
|
|
|
|
--- a/src/main/java/org/bukkit/packs/DataPackManager.java
|
|
|
|
+++ b/src/main/java/org/bukkit/packs/DataPackManager.java
|
|
|
|
@@ -11,8 +11,10 @@ import org.jetbrains.annotations.Nullable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Manager of data packs.
|
|
|
|
+ * @deprecated use {@link io.papermc.paper.datapack.DatapackManager}
|
|
|
|
*/
|
|
|
|
@ApiStatus.Experimental
|
|
|
|
+@Deprecated(forRemoval = true) // Paper
|
|
|
|
public interface DataPackManager {
|
|
|
|
|
|
|
|
/**
|