mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-20 07:19:23 +00:00
* remove this * rct dev * experiment this * it finally works! * update description * fix mob issues * sync to new config * Fix realocation of configs for spark * RCT split chunks rewrite and other features * add debug * even more optimizations and comment out debug * oops * merge RCT patches * some final changes * add experimental warn * [ci-skip] update readme info --------- Co-authored-by: dan28000 <pirkldan28@gmail.com>
51 lines
3.1 KiB
Diff
51 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: dan28000 <pirkldan28@gmail.com>
|
|
Date: Thu, 12 Jun 2025 10:08:25 +0200
|
|
Subject: [PATCH] Implement loading plugins from external folder
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
|
index 70413fddd23ca1165cb5090cce4fddcb1bbca93f..ae70b84e6473fa2ed94416bf4bef88492de3e5f8 100644
|
|
--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
|
+++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
|
@@ -112,6 +112,20 @@ public class PluginInitializerManager {
|
|
// Register the default plugin directory
|
|
io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.DirectoryProviderSource.INSTANCE, pluginSystem.pluginDirectoryPath());
|
|
|
|
+ // DivineMC start - Register the plugin directory from flags
|
|
+ @SuppressWarnings("unchecked")
|
|
+ java.util.List<Path> pluginList = ((java.util.List<File>) optionSet.valuesOf("add-plugin-dir")).stream()
|
|
+ .filter(java.util.Objects::nonNull)
|
|
+ .map(f -> f.listFiles(file -> file.getName().endsWith(".jar")))
|
|
+ .filter(java.util.Objects::nonNull)
|
|
+ .flatMap(java.util.Arrays::stream)
|
|
+ .filter(File::isFile)
|
|
+ .map(File::toPath)
|
|
+ .toList();
|
|
+
|
|
+ io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.PluginFlagProviderSource.INSTANCE, pluginList);
|
|
+ // DivineMC end - Register the plugin directory from flags
|
|
+
|
|
// Register plugins from the flag
|
|
@SuppressWarnings("unchecked")
|
|
java.util.List<Path> files = ((java.util.List<File>) optionSet.valuesOf("add-plugin")).stream().map(File::toPath).toList();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index d7f9da2e624d3e27aff36d8818adaf735d78a2d9..3f3bbc71bc4870cf1271d6c28a77ff78a5e102f8 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -181,6 +181,14 @@ public class Main {
|
|
.describedAs("Yml file");
|
|
// DivineMC end - Configuration
|
|
|
|
+ // DivineMC start - Implement loading plugins from external folder
|
|
+ acceptsAll(asList("add-plugin-dir", "add-extra-plugin-dir"), "Specify paths to directories containing extra plugin jars to be loaded in addition to those in the plugins folder. This argument can be specified multiple times, once for each extra plugin directory path.")
|
|
+ .withRequiredArg()
|
|
+ .ofType(File.class)
|
|
+ .defaultsTo(new File("extra"))
|
|
+ .describedAs("Directory");
|
|
+ // DivineMC end - Implement loading plugins from external folder
|
|
+
|
|
acceptsAll(asList("server-name"), "Name of the server")
|
|
.withRequiredArg()
|
|
.ofType(String.class)
|