Bukkit/Bukkit — pull request #420 by holic (2011-11-22 06:51:26+00:00)
Title: Call PluginDisableEvent before plugin.setEnabled(false)

Dependencies and load order are currently disregarded when disabling all plugins (i.e. `stop` console command). In addition to being more consistent in how events are called throughout Bukkit (pre-event, not post-event, unless named with past tense), this small change allows dependent plugins to listen for a dependency's disable event and do work before its `onDisable` method is called.

My current use case involves a database query plugin that depends on a database connection pooling plugin. The query plugin queues up queries to be run at an interval. On a `stop` command, the query plugin quickly tries to flush its queue to the database before disabling. The connection pooling plugin `onDisable` releases its pools and closes its connections. This is a problem when the connection pooling plugin sits above the query plugin in the plugin list and is disabled before the queue is flushed, leaving no pools/connections available.