Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Datapacks #8865

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions patches/api/0008-Paper-Plugins.patch
Original file line number Diff line number Diff line change
Expand Up @@ -892,14 +892,13 @@ index 0000000000000000000000000000000000000000..9af07d168beadaa77e4965819200eeb9
+}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..64e46fdfa4d404cb08c67a456e5990b729296b98
index 0000000000000000000000000000000000000000..a37a0b9e161aaf9db892ca4993033076cd924fc3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/classloader/ClassLoaderAccess.java
@@ -0,0 +1,34 @@
@@ -0,0 +1,33 @@
+package io.papermc.paper.plugin.provider.classloader;
+
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * The class loader access interface is an <b>internal</b> representation of a class accesses' ability to see types
Expand Down
73 changes: 73 additions & 0 deletions patches/api/0424-Plugin-Datapacks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 9 Jan 2021 22:21:41 -0800
Subject: [PATCH] Plugin Datapacks


diff --git a/src/main/java/io/papermc/paper/plugin/DatapackConfiguration.java b/src/main/java/io/papermc/paper/plugin/DatapackConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..9e48ad4f2bd9d73fdaf1e05b5338e4a54d5cd146
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/DatapackConfiguration.java
@@ -0,0 +1,22 @@
+package io.papermc.paper.plugin;
+
+import net.kyori.adventure.text.Component;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public interface DatapackConfiguration {
+
+ /**
+ * Gets the directory inside the plugin's file for the datapack.
+ *
+ * @return the datapack directory
+ */
+ @NotNull String directory();
+
+ /**
+ * Gets the datapack's configured name.
+ *
+ * @return the name or null if none configured
+ */
+ @Nullable Component name();
+}
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
index ef393f1f93ca48264fc1b6e3a27787f6a9152e1b..c0037d779cbfe926221559598fc9965717202768 100644
--- a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
+++ b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
@@ -1,5 +1,6 @@
package io.papermc.paper.plugin.configuration;

+import io.papermc.paper.plugin.DatapackConfiguration;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.PluginLoadOrder;
@@ -200,4 +201,11 @@ public interface PluginMeta {
@Nullable
String getAPIVersion();

+ /**
+ * Get the configuration for the datapack associated with the plugin.
+ *
+ * @return the datapack configuration (or null if none)
+ */
+ @Nullable DatapackConfiguration getDatapackConfiguration();
+
}
diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
index 07e8908d25fcd4e5eabadc9f019b54acff3b5e3c..3262604179abd4899d474c1a48d6a4871155a393 100644
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
+++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
@@ -321,6 +321,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
public @NotNull List<String> getProvidedPlugins() {
return this.provides;
}
+
+ @Override
+ public @Nullable io.papermc.paper.plugin.DatapackConfiguration getDatapackConfiguration() {
+ return null;
+ }
// Paper end

public PluginDescriptionFile(@NotNull final InputStream stream) throws InvalidDescriptionException {
26 changes: 8 additions & 18 deletions patches/server/0013-Paper-Plugins.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5364,7 +5364,7 @@ index 0000000000000000000000000000000000000000..49a087381307eab263f7dad43aaa2598
+}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..2f2e183cdee865448ca90d2da9e3db7135b741f5
index 0000000000000000000000000000000000000000..f8b8a3fdba9dc1a6d9f6efb96ee1776cea6a388d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java
@@ -0,0 +1,47 @@
Expand All @@ -5377,6 +5377,7 @@ index 0000000000000000000000000000000000000000..2f2e183cdee865448ca90d2da9e3db71
+import java.nio.file.FileVisitOption;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.logging.Level;
+
+/**
+ * Loads all plugin providers in the given directory.
Expand Down Expand Up @@ -5414,7 +5415,6 @@ index 0000000000000000000000000000000000000000..2f2e183cdee865448ca90d2da9e3db71
+ // Avoid loading plugins that start with a dot
+ return Files.isRegularFile(path) && !path.startsWith(".");
+ }
+}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..c828eeb8b0b87ee7f3e76a4b0ee146c86348061c
Expand Down Expand Up @@ -5809,25 +5809,18 @@ index 0000000000000000000000000000000000000000..e34656fb0573ff6d826eb4d4dcfd517e
+}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..b7e8a5ba375a558e0442aa9facf96954a9bb135f
index 0000000000000000000000000000000000000000..d905fb283801f272fbba99a58477d439db357971
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperLoadOrderConfiguration.java
@@ -0,0 +1,44 @@
@@ -0,0 +1,37 @@
+package io.papermc.paper.plugin.provider.type.paper;
+
+import io.papermc.paper.plugin.configuration.PluginMeta;
+import io.papermc.paper.plugin.provider.PluginProvider;
+import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration;
+import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
+import io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class PaperLoadOrderConfiguration implements LoadOrderConfiguration {
+
Expand Down Expand Up @@ -6191,17 +6184,16 @@ index 0000000000000000000000000000000000000000..1ba051931d3ce6ac0bef559911e44530
+}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..b2a6544e321fa61c58bdf5684231de1020884fcc
index 0000000000000000000000000000000000000000..96f84f965f30db09c516a616ba8b5166b4a4c501
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotLoadOrderConfiguration.java
@@ -0,0 +1,72 @@
@@ -0,0 +1,71 @@
+package io.papermc.paper.plugin.provider.type.spigot;
+
+import io.papermc.paper.plugin.configuration.PluginMeta;
+import io.papermc.paper.plugin.provider.PluginProvider;
+import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
Expand Down Expand Up @@ -6634,10 +6626,10 @@ index 0000000000000000000000000000000000000000..374e7d3d69fc8603ecf54999f173123d
+}
diff --git a/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java b/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java
new file mode 100644
index 0000000000000000000000000000000000000000..cb9b13522a976b82bcb71cef486f11f4172e3e99
index 0000000000000000000000000000000000000000..420984658613470370dcdf655fecb0225712fb8d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/storage/ServerPluginProviderStorage.java
@@ -0,0 +1,70 @@
@@ -0,0 +1,68 @@
+package io.papermc.paper.plugin.storage;
+
+import com.mojang.logging.LogUtils;
Expand All @@ -6646,8 +6638,6 @@ index 0000000000000000000000000000000000000000..cb9b13522a976b82bcb71cef486f11f4
+import io.papermc.paper.plugin.entrypoint.strategy.ProviderConfiguration;
+import io.papermc.paper.plugin.manager.PaperPluginManagerImpl;
+import io.papermc.paper.plugin.provider.PluginProvider;
+import io.papermc.paper.plugin.provider.ProviderStatus;
+import io.papermc.paper.plugin.provider.ProviderStatusHolder;
+import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
Expand Down
Loading
Loading