Catch setEnabled to ensure classloader is properly unloaded (#10020)

This commit is contained in:
Owen1212055 2023-12-10 20:02:26 -05:00
parent a3a40ecd2b
commit a52612213b

View file

@ -3994,8 +3994,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ plugin.getLogger().info("Disabling %s".formatted(pluginName));
+
+ this.server.getPluginManager().callEvent(new PluginDisableEvent(plugin));
+
+ javaPlugin.setEnabled(false);
+ try {
+ javaPlugin.setEnabled(false);
+ } catch (Throwable ex) {
+ this.server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + pluginName, ex);
+ }
+
+ ClassLoader classLoader = plugin.getClass().getClassLoader();
+ if (classLoader instanceof ConfiguredPluginClassLoader configuredPluginClassLoader) {