mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Catch setEnabled to ensure classloader is properly unloaded (#10020)
This commit is contained in:
parent
dd16335e40
commit
28abbaa7bd
1 changed files with 7 additions and 4 deletions
|
@ -3767,10 +3767,10 @@ index 0000000000000000000000000000000000000000..92a69677f21b2c1c035119d8e5a6af63
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..08b1aab5d37a56dc42542ce15ba1f7ccd1b08400
|
index 0000000000000000000000000000000000000000..846bdcccf1031e41c4da29da885aa4d438507631
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
||||||
@@ -0,0 +1,302 @@
|
@@ -0,0 +1,305 @@
|
||||||
+package io.papermc.paper.plugin.manager;
|
+package io.papermc.paper.plugin.manager;
|
||||||
+
|
+
|
||||||
+import com.google.common.base.Preconditions;
|
+import com.google.common.base.Preconditions;
|
||||||
|
@ -3994,8 +3994,11 @@ index 0000000000000000000000000000000000000000..08b1aab5d37a56dc42542ce15ba1f7cc
|
||||||
+ plugin.getLogger().info("Disabling %s".formatted(pluginName));
|
+ plugin.getLogger().info("Disabling %s".formatted(pluginName));
|
||||||
+
|
+
|
||||||
+ this.server.getPluginManager().callEvent(new PluginDisableEvent(plugin));
|
+ this.server.getPluginManager().callEvent(new PluginDisableEvent(plugin));
|
||||||
+
|
+ try {
|
||||||
+ javaPlugin.setEnabled(false);
|
+ javaPlugin.setEnabled(false);
|
||||||
|
+ } catch (Throwable ex) {
|
||||||
|
+ this.server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + pluginName, ex);
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ ClassLoader classLoader = plugin.getClass().getClassLoader();
|
+ ClassLoader classLoader = plugin.getClass().getClassLoader();
|
||||||
+ if (classLoader instanceof ConfiguredPluginClassLoader configuredPluginClassLoader) {
|
+ if (classLoader instanceof ConfiguredPluginClassLoader configuredPluginClassLoader) {
|
||||||
|
|
Loading…
Reference in a new issue