mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
24 lines
1.4 KiB
Diff
24 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
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 f7cfe6c0d9d52ed72d0d45baaaf856c15769c668..cb3c25ef46b279ffdde87f47f729eb8aa7549c1c 100644
|
|
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
@@ -162,6 +162,11 @@ 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")) {
|
|
+ (plugin != null ? plugin.getLogger() : loader.server.getLogger()).log(Level.WARNING, "Stacktrace", new Exception());
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|