diff --git a/patches/api/Add-system-property-to-print-stacktrace-on-bad-plugi.patch b/patches/api/Add-system-property-to-print-stacktrace-on-bad-plugi.patch new file mode 100644 index 0000000000..09e4e127a3 --- /dev/null +++ b/patches/api/Add-system-property-to-print-stacktrace-on-bad-plugi.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 1 Oct 2022 09:44:26 +0200 +Subject: [PATCH] Add system property to print stacktrace on bad plugin class + access + + +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -0,0 +0,0 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot + // In case the bad access occurs on construction + loader.server.getLogger().log(Level.WARNING, "[{0}] Loaded class {1} from {2} which is not a depend or softdepend of this plugin.", new Object[]{description.getName(), name, provider.getFullName()}); + } ++ // Paper start ++ if (Boolean.getBoolean("Paper.printStacktraceOnBadPluginClassAccess")) { ++ new Exception().printStackTrace(); ++ } ++ // Paper end + } + } +