diff --git a/patches/server/Paper-Plugins.patch b/patches/server/Paper-Plugins.patch index 5f86f5776a..01ecbb57c5 100644 --- a/patches/server/Paper-Plugins.patch +++ b/patches/server/Paper-Plugins.patch @@ -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);