Paper/Spigot-API-Patches/0207-Provide-a-useful-PluginClassLoader-toString.patch
Jake Potrebic cb896d4710
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
146a7e4b SPIGOT-5345: Add automatic library support

CraftBukkit Changes:
b1064c69 Remove sisu annotation processor from jar
32e40866 SPIGOT-6189: Persistent data disappears when calling setFacingDirection on an item frame
d189f78b # 827: Trigger vanilla dimension advancements in non-main worlds
5bbb4a65 Add plumbing for automatic library support

Spigot Changes:
9fb885e8 Rebuild patches
2021-05-15 22:52:07 +00:00

31 lines
1.4 KiB
Diff

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
index e7a8a221a23d2adc497afd21e512eecba4c63a6b..11e5618ff66385574ba04db0942a75227cf8eb0f 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -226,4 +226,16 @@ 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
}