From be759ba36e07b3a9fa22ab6c2bc9ddbc2e0a87dd Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 27 Jan 2011 16:15:24 -0500 Subject: [PATCH] onDisable on stop - stephank By: Taylor Kelly --- .../src/main/java/org/bukkit/plugin/PluginManager.java | 5 +++++ .../main/java/org/bukkit/plugin/SimplePluginManager.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java index b42da9eb23..01656a4514 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/PluginManager.java @@ -75,6 +75,11 @@ public interface PluginManager { */ public Plugin[] loadPlugins(File directory); + /** + * Disables all the loaded plugins + */ + public void disablePlugins(); + /** * Calls a player related event with the given details * diff --git a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java index a3899f564c..91d2b3ba28 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -176,6 +176,12 @@ public final class SimplePluginManager implements PluginManager { } } + public void disablePlugins() { + for(Plugin plugin: getPlugins()) { + disablePlugin(plugin); + } + } + public void disablePlugin(final Plugin plugin) { if (plugin.isEnabled()) { plugin.getPluginLoader().disablePlugin(plugin);