mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Expose Path to jar file in PluginProviderContext (#9030)
* Expose Path to jar file in PluginProviderContext * rename accessor, reword jd
This commit is contained in:
parent
38be4f873b
commit
d5abb94e69
@ -243,10 +243,10 @@ index 0000000000000000000000000000000000000000..ea84b11e8682e73fcd563fec65e76b70
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8be416f01055d94b474ecc425fc0bec69a814815
|
||||
index 0000000000000000000000000000000000000000..a9208254142d270da7bd4815a01b9627c7918c11
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
|
||||
@@ -0,0 +1,44 @@
|
||||
@@ -0,0 +1,52 @@
|
||||
+package io.papermc.paper.plugin.bootstrap;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
@ -290,6 +290,14 @@ index 0000000000000000000000000000000000000000..8be416f01055d94b474ecc425fc0bec6
|
||||
+ @NotNull
|
||||
+ ComponentLogger getLogger();
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the path to the originating source of the plugin, such as the plugin's JAR file.
|
||||
+ *
|
||||
+ * @return the previously described path
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Path getPluginSource();
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
||||
new file mode 100644
|
||||
|
@ -594,10 +594,10 @@ index 0000000000000000000000000000000000000000..89bf48fd581ee6580b91e2eb31dd532c
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7bf5daaeec4e4e3911741fa482def13b6044ce97
|
||||
index 0000000000000000000000000000000000000000..2e450a9fce66e63ec94ee3d2579265eda28a1c3f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContextImpl.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package io.papermc.paper.plugin.bootstrap;
|
||||
+
|
||||
+import io.papermc.paper.plugin.PluginInitializerManager;
|
||||
@ -609,18 +609,18 @@ index 0000000000000000000000000000000000000000..7bf5daaeec4e4e3911741fa482def13b
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+public record PluginProviderContextImpl(PluginMeta config, Path dataFolder,
|
||||
+ ComponentLogger logger) implements PluginProviderContext {
|
||||
+ ComponentLogger logger, Path pluginSource) implements PluginProviderContext {
|
||||
+
|
||||
+ public static PluginProviderContextImpl of(PluginMeta config, ComponentLogger logger) {
|
||||
+ public static PluginProviderContextImpl of(PluginMeta config, ComponentLogger logger, Path pluginSource) {
|
||||
+ Path dataFolder = PluginInitializerManager.instance().pluginDirectoryPath().resolve(config.getDisplayName());
|
||||
+
|
||||
+ return new PluginProviderContextImpl(config, dataFolder, logger);
|
||||
+ return new PluginProviderContextImpl(config, dataFolder, logger, pluginSource);
|
||||
+ }
|
||||
+
|
||||
+ public static PluginProviderContextImpl of(PluginProvider<?> provider, Path pluginFolder) {
|
||||
+ Path dataFolder = pluginFolder.resolve(provider.getMeta().getDisplayName());
|
||||
+
|
||||
+ return new PluginProviderContextImpl(provider.getMeta(), dataFolder, provider.getLogger());
|
||||
+ return new PluginProviderContextImpl(provider.getMeta(), dataFolder, provider.getLogger(), provider.getSource());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -637,6 +637,11 @@ index 0000000000000000000000000000000000000000..7bf5daaeec4e4e3911741fa482def13b
|
||||
+ public @NotNull ComponentLogger getLogger() {
|
||||
+ return this.logger;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Path getPluginSource() {
|
||||
+ return this.pluginSource;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/Entrypoint.java b/src/main/java/io/papermc/paper/plugin/entrypoint/Entrypoint.java
|
||||
new file mode 100644
|
||||
@ -5709,7 +5714,7 @@ index 0000000000000000000000000000000000000000..016c5af192948a3908f77aa6e3e6db1c
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eb0464a52d99a916bca8f93cd9294cdc30893671
|
||||
index 0000000000000000000000000000000000000000..1ba051931d3ce6ac0bef559911e4453044266aab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
||||
@@ -0,0 +1,56 @@
|
||||
@ -5741,7 +5746,7 @@ index 0000000000000000000000000000000000000000..eb0464a52d99a916bca8f93cd9294cdc
|
||||
+ public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) throws Exception {
|
||||
+ Logger jul = PaperPluginLogger.getLogger(configuration);
|
||||
+ ComponentLogger logger = ComponentLogger.logger(jul.getName());
|
||||
+ PluginProviderContext context = PluginProviderContextImpl.of(configuration, logger);
|
||||
+ PluginProviderContext context = PluginProviderContextImpl.of(configuration, logger, source);
|
||||
+
|
||||
+ PaperClasspathBuilder builder = new PaperClasspathBuilder(context);
|
||||
+
|
||||
|
Loading…
Reference in New Issue
Block a user