From 4e9fcec4a4bcd6b18a6e00de56161f1f45c7b85c Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 15 Jan 2012 08:16:57 +0000 Subject: [PATCH] Changed PluginDisableEvent to fire before the disabling of a plugin, instead of after (where it's then invalid). Thanks to holic for the PR. By: Nathan Adams --- .../main/java/org/bukkit/plugin/java/JavaPluginLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 5126f9a03c..bccc0c135e 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -991,6 +991,8 @@ public class JavaPluginLoader implements PluginLoader { } if (plugin.isEnabled()) { + server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); + JavaPlugin jPlugin = (JavaPlugin) plugin; ClassLoader cloader = jPlugin.getClassLoader(); @@ -1000,8 +1002,6 @@ public class JavaPluginLoader implements PluginLoader { server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?): " + ex.getMessage(), ex); } - server.getPluginManager().callEvent(new PluginDisableEvent(plugin)); - loaders.remove(jPlugin.getDescription().getName()); if (cloader instanceof PluginClassLoader) {