geforkt von Mirrors/Paper
Check for server JARs in plugin directory (#10228)
Dieser Commit ist enthalten in:
Ursprung
03d5d38a6a
Commit
dec84759dc
@ -3,6 +3,7 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Wed, 6 Jul 2022 23:00:31 -0400
|
||||
Subject: [PATCH] Paper Plugins
|
||||
|
||||
Co-authored-by: Micah Rao <micah.s.rao@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -5617,7 +5618,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ JarFile file = new JarFile(context.toFile(), true, JarFile.OPEN_READ, JarFile.runtimeVersion());
|
||||
+ PluginFileType<?, ?> type = PluginFileType.guessType(file);
|
||||
+ if (type == null) {
|
||||
+ throw new IllegalArgumentException(source + " does not contain a " + String.join(" or ", PluginFileType.getConfigTypes()) + "! Could not determine plugin type, cannot load a plugin from it!");
|
||||
+ // Throw IAE wrapped in RE to prevent callers from considering this a "invalid parameter" as caller ignores IAE.
|
||||
+ // TODO: This needs some heavy rework, using illegal argument exception to signal an actual failure is less than ideal.
|
||||
+ if (file.getEntry("META-INF/versions.list") != null) {
|
||||
+ throw new RuntimeException(new IllegalArgumentException(context + " appears to be a server jar! Server jars do not belong in the plugin folder."));
|
||||
+ }
|
||||
+
|
||||
+ throw new RuntimeException(
|
||||
+ new IllegalArgumentException(source + " does not contain a " + String.join(" or ", PluginFileType.getConfigTypes()) + "! Could not determine plugin type, cannot load a plugin from it!")
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ type.register(entrypointHandler, file, context);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren