geforkt von Mirrors/Paper
107 Zeilen
3.1 KiB
Diff
107 Zeilen
3.1 KiB
Diff
|
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..0000000000000000000000000000000000000000
|
||
|
--- /dev/null
|
||
|
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||
|
@@ -0,0 +0,0 @@
|
||
|
+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..0000000000000000000000000000000000000000
|
||
|
--- /dev/null
|
||
|
+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||
|
@@ -0,0 +0,0 @@
|
||
|
+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
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||
|
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||
|
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
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/org/bukkit/Server.java
|
||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||
|
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||
|
*/
|
||
|
@NotNull
|
||
|
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||
|
+
|
||
|
+ /**
|
||
|
+ * @return the datapack manager
|
||
|
+ */
|
||
|
+ @NotNull
|
||
|
+ io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
||
|
// Paper end
|
||
|
}
|