parent
4276013833
commit
5344798579
5 changed files with 101 additions and 42 deletions
|
@ -7,12 +7,15 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
|||
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 ea902f8d525684e0e8f82bc5017bcf748f106e40..b80930a5e3812c1b02f11ff9c592ee8a39b08456 100644
|
||||
index ea902f8d525684e0e8f82bc5017bcf748f106e40..8ba95157e0273c412314a506d4f6e24b0784147b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -409,8 +409,13 @@ public final class CraftServer implements Server {
|
||||
@@ -407,10 +407,15 @@ public final class CraftServer implements Server {
|
||||
public void loadPlugins() {
|
||||
this.pluginManager.registerInterface(JavaPluginLoader.class);
|
||||
|
||||
File pluginFolder = (File) console.options.valueOf("plugins");
|
||||
- File pluginFolder = (File) console.options.valueOf("plugins");
|
||||
+ File pluginFolder = this.getPluginsFolder(); // Paper
|
||||
|
||||
- if (pluginFolder.exists()) {
|
||||
- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder);
|
||||
|
@ -26,19 +29,36 @@ index ea902f8d525684e0e8f82bc5017bcf748f106e40..b80930a5e3812c1b02f11ff9c592ee8a
|
|||
for (Plugin plugin : plugins) {
|
||||
try {
|
||||
String message = String.format("Loading %s", plugin.getDescription().getFullName());
|
||||
@@ -425,6 +430,18 @@ public final class CraftServer implements Server {
|
||||
@@ -425,6 +430,35 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public File getPluginsFolder() {
|
||||
+ return (File) this.console.options.valueOf("plugins");
|
||||
+ }
|
||||
+
|
||||
+ 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());
|
||||
+ final List<File> list = new ArrayList<>();
|
||||
+ for (final File file : jars) {
|
||||
+ if (!file.exists()) {
|
||||
+ MinecraftServer.LOGGER.warn("File '{}' specified through 'add-plugin' argument does not exist, cannot load a plugin from it!", file.getAbsolutePath());
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!file.isFile()) {
|
||||
+ MinecraftServer.LOGGER.warn("File '{}' specified through 'add-plugin' argument is not a file, cannot load a plugin from it!", file.getAbsolutePath());
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!file.getName().endsWith(".jar")) {
|
||||
+ MinecraftServer.LOGGER.warn("File '{}' specified through 'add-plugin' argument is not a jar file, cannot load a plugin from it!", file.getAbsolutePath());
|
||||
+ continue;
|
||||
+ }
|
||||
+ list.add(file);
|
||||
+ }
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
|
|
@ -265,7 +265,7 @@ index cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485..cfd43069ee2b6f79afb12e10d223f6bf
|
|||
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, worlds, eraseCache);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 33dcb39428c3bd24daa600c2b486954466d81eef..1f6d59d1a95fcc8f93685a9ed6bb1d9419aafb95 100644
|
||||
index 84afe36963178aa0319e219244ddbe6f0b91260b..be6b19b587ae2bbc708d712fc4327e4c56b7197c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -563,13 +563,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -352,10 +352,10 @@ index 43510774d489bfdd30f10d521e424fa1363b8919..6496108953effae82391b5c1ea6fdec8
|
|||
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index b80930a5e3812c1b02f11ff9c592ee8a39b08456..f4a7b1b45d8284a5552dce67979282ce09e71a36 100644
|
||||
index 8ba95157e0273c412314a506d4f6e24b0784147b..1d4608ad87dd81cda40b21583f1c6aa7ac032134 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1175,14 +1175,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1192,14 +1192,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
worlddata.checkName(name);
|
||||
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().isPresent());
|
||||
|
@ -371,7 +371,7 @@ index b80930a5e3812c1b02f11ff9c592ee8a39b08456..f4a7b1b45d8284a5552dce67979282ce
|
|||
|
||||
long j = BiomeManager.obfuscateSeed(creator.seed());
|
||||
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
|
||||
@@ -1211,6 +1204,14 @@ public final class CraftServer implements Server {
|
||||
@@ -1228,6 +1221,14 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue