Create a Guice Injector for the server, with a child Injector for each plugin.
Allow plugin main class to be a Guice Module instead of a Plugin, in which case the module will be used to create the plugin's private injector, and a generic Plugin instance is provided. ProtectedModule can be used to get access to the global environment.
Alternately, Plugin#configure can be implemented to configure the plugin's injector. This is intended more for transitional code.
Many Bukkit services have bindings, some globally and some per-plugin. See ServerModule and PluginModule for most of these.
Several things can be registered at configuration time:
Injector
for the server, with a childInjector
for each plugin.Module
instead of aPlugin
, in which case the module will be used to create the plugin's private injector, and a genericPlugin
instance is provided.ProtectedModule
can be used to get access to the global environment.Plugin#configure
can be implemented to configure the plugin's injector. This is intended more for transitional code.ServerModule
andPluginModule
for most of these.Enableable
s which receive lifecycle callbacksTickable
s which get periodic callbacksListener
sPermission
s