onDisable on stop - stephank

By: Taylor Kelly <tkelly910@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-01-27 16:15:24 -05:00
parent b26b68a61a
commit be759ba36e
2 changed files with 11 additions and 0 deletions

View file

@ -75,6 +75,11 @@ public interface PluginManager {
*/ */
public Plugin[] loadPlugins(File directory); public Plugin[] loadPlugins(File directory);
/**
* Disables all the loaded plugins
*/
public void disablePlugins();
/** /**
* Calls a player related event with the given details * Calls a player related event with the given details
* *

View file

@ -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) { public void disablePlugin(final Plugin plugin) {
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
plugin.getPluginLoader().disablePlugin(plugin); plugin.getPluginLoader().disablePlugin(plugin);