geforkt von Mirrors/Paper
aa52bf9e33
Mojang made some changes to priorities in 1.17 and it seems that these changes conflict with the changes made in this patch, which in some cases appears to cause excessive rescheduling of tasks. This, however, is not confirmed as such but seems to be the behavior that we're seeing to cause this issue, if mojang has adopted the changes we suggested, then a good chunk of this patch may be unneeded, but, this needs a much better look than I'm currently able to do
65 Zeilen
3.1 KiB
Diff
65 Zeilen
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
Date: Tue, 18 May 2021 14:39:44 -0700
|
|
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
|
plugins folder
|
|
|
|
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 45ae98058d4207ccf9cc85fe27021356438a08fa..85d078f7c0e5338315ba8290dd4981e59dbc7956 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -394,8 +394,13 @@ public final class CraftServer implements Server {
|
|
|
|
File pluginFolder = (File) console.options.valueOf("plugins");
|
|
|
|
- if (pluginFolder.exists()) {
|
|
- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder);
|
|
+ // Paper start
|
|
+ if (true || pluginFolder.exists()) {
|
|
+ if (!pluginFolder.exists()) {
|
|
+ pluginFolder.mkdirs();
|
|
+ }
|
|
+ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars());
|
|
+ // Paper end
|
|
for (Plugin plugin : plugins) {
|
|
try {
|
|
String message = String.format("Loading %s", plugin.getDescription().getFullName());
|
|
@@ -410,6 +415,18 @@ public final class CraftServer implements Server {
|
|
}
|
|
}
|
|
|
|
+ // Paper start
|
|
+ private List<File> extraPluginJars() {
|
|
+ @SuppressWarnings("unchecked")
|
|
+ final List<File> jars = (List<File>) this.console.options.valuesOf("add-plugin");
|
|
+ return jars.stream()
|
|
+ .filter(File::exists)
|
|
+ .filter(File::isFile)
|
|
+ .filter(file -> file.getName().endsWith(".jar"))
|
|
+ .collect(java.util.stream.Collectors.toList());
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public void enablePlugins(PluginLoadOrder type) {
|
|
if (type == PluginLoadOrder.STARTUP) {
|
|
this.helpMap.clear();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index c687df04b3543df763a4d5225342357355fab7ec..22e9dd17f62103c5061435099ce96a3d70d54808 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -153,6 +153,12 @@ public class Main {
|
|
.ofType(String.class)
|
|
.defaultsTo("Unknown Server")
|
|
.describedAs("Name");
|
|
+
|
|
+ acceptsAll(asList("add-plugin", "add-extra-plugin-jar"), "Specify paths to 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 jar path.")
|
|
+ .withRequiredArg()
|
|
+ .ofType(File.class)
|
|
+ .defaultsTo(new File[] {})
|
|
+ .describedAs("Jar file");
|
|
// Paper end
|
|
}
|
|
};
|