2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
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
|
2022-02-12 14:20:33 +01:00
|
|
|
index 46b705197e7520cea19da24769bce71406ec6a31..c0781480ac1562bff7415f0947d733b438a4d04b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
|
|
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
2021-10-15 13:43:19 +02:00
|
|
|
@@ -235,4 +235,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
|
|
|
}
|