geforkt von Mirrors/Paper
Expose Path to jar file in PluginProviderContext (#9030)
* Expose Path to jar file in PluginProviderContext * rename accessor, reword jd
Dieser Commit ist enthalten in:
Ursprung
5326cb65f0
Commit
4e30130da0
@ -290,6 +290,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ @NotNull
|
+ @NotNull
|
||||||
+ ComponentLogger getLogger();
|
+ 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
|
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
|
new file mode 100644
|
||||||
|
@ -609,18 +609,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.nio.file.Path;
|
+import java.nio.file.Path;
|
||||||
+
|
+
|
||||||
+public record PluginProviderContextImpl(PluginMeta config, Path dataFolder,
|
+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());
|
+ 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) {
|
+ public static PluginProviderContextImpl of(PluginProvider<?> provider, Path pluginFolder) {
|
||||||
+ Path dataFolder = pluginFolder.resolve(provider.getMeta().getDisplayName());
|
+ 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
|
+ @Override
|
||||||
@ -637,6 +637,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public @NotNull ComponentLogger getLogger() {
|
+ public @NotNull ComponentLogger getLogger() {
|
||||||
+ return this.logger;
|
+ 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
|
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
|
new file mode 100644
|
||||||
@ -5741,7 +5746,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) throws Exception {
|
+ public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) throws Exception {
|
||||||
+ Logger jul = PaperPluginLogger.getLogger(configuration);
|
+ Logger jul = PaperPluginLogger.getLogger(configuration);
|
||||||
+ ComponentLogger logger = ComponentLogger.logger(jul.getName());
|
+ ComponentLogger logger = ComponentLogger.logger(jul.getName());
|
||||||
+ PluginProviderContext context = PluginProviderContextImpl.of(configuration, logger);
|
+ PluginProviderContext context = PluginProviderContextImpl.of(configuration, logger, source);
|
||||||
+
|
+
|
||||||
+ PaperClasspathBuilder builder = new PaperClasspathBuilder(context);
|
+ PaperClasspathBuilder builder = new PaperClasspathBuilder(context);
|
||||||
+
|
+
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren