From 7ae7528cfb6d7925617d35a4f1ec6b8fe3fc0f46 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 31 May 2020 15:28:35 +0100 Subject: [PATCH] Provide a useful PluginClassLoader#toString There are several cases where the plugin classloader may be dumped to the logs, however, this provides no indication of the owner of the classloader, making these messages effectively useless, this patch rectifies this --- ...-a-useful-PluginClassLoader-toString.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Spigot-API-Patches/Provide-a-useful-PluginClassLoader-toString.patch diff --git a/Spigot-API-Patches/Provide-a-useful-PluginClassLoader-toString.patch b/Spigot-API-Patches/Provide-a-useful-PluginClassLoader-toString.patch new file mode 100644 index 0000000000..6380e62aaf --- /dev/null +++ b/Spigot-API-Patches/Provide-a-useful-PluginClassLoader-toString.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 31 May 2020 15:26:17 +0100 +Subject: [PATCH] Provide a useful PluginClassLoader#toString + +There are several cases where the plugin classloader may be dumped to the logs, +however, this provides no indication of the owner of the classloader, making +these messages effectively useless, this patch rectifies this + +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 + javaPlugin.logger = this.logger; // Paper - set logger + javaPlugin.init(loader, loader.server, description, dataFolder, file, this); + } ++ ++ // Paper start ++ @Override ++ public String toString() { ++ JavaPlugin currPlugin = plugin != null ? plugin : pluginInit; ++ return "PluginClassLoader{" + ++ "plugin=" + currPlugin + ++ ", pluginEnabled=" + (currPlugin == null ? "uninitialized" : currPlugin.isEnabled()) + ++ ", url=" + file + ++ '}'; ++ } ++ // Paper end + }