Package net.md_5.bungee.api.plugin
Class PluginManager
java.lang.Object
net.md_5.bungee.api.plugin.PluginManager
Class to manage bridging between plugin duties and implementation duties, for
example event handling and plugin management.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Event>
TcallEvent(T event) Dispatch an event to all subscribed listeners and return the event once it has been handled by these listeners.voiddetectPlugins(File folder) Load all plugins from the specified folder.booleandispatchCommand(CommandSender sender, String commandLine) Execute a command if it is registered, else return false.Returns a loaded plugin identified by the specified name.Returns thePluginobjects corresponding to all loaded plugins.voidvoidregisterCommand(Plugin plugin, Command command) Register a command so that it may be executed.voidregisterListener(Plugin plugin, Listener listener) Register aListenerfor receiving called events.voidunregisterCommand(Command command) Unregister a command so it will no longer be executed.voidunregisterCommands(Plugin plugin) Unregister all commands owned by aPluginvoidunregisterListener(Listener listener) Unregister aListenerso that the events do not reach it anymore.voidunregisterListeners(Plugin plugin) Unregister all of a Plugin's listener.
-
Constructor Details
-
PluginManager
-
-
Method Details
-
registerCommand
Register a command so that it may be executed.- Parameters:
plugin- the plugin owning this commandcommand- the command to register
-
unregisterCommand
Unregister a command so it will no longer be executed.- Parameters:
command- the command to unregister
-
unregisterCommands
Unregister all commands owned by aPlugin- Parameters:
plugin- the plugin to register the commands of
-
dispatchCommand
Execute a command if it is registered, else return false.- Parameters:
sender- the sender executing the commandcommandLine- the complete command line including command name and arguments- Returns:
- whether the command was handled
-
getPlugins
Returns thePluginobjects corresponding to all loaded plugins.- Returns:
- the set of loaded plugins
-
getPlugin
Returns a loaded plugin identified by the specified name.- Parameters:
name- of the plugin to retrieve- Returns:
- the retrieved plugin or null if not loaded
-
loadAndEnablePlugins
public void loadAndEnablePlugins() -
detectPlugins
Load all plugins from the specified folder.- Parameters:
folder- the folder to search for plugins in
-
callEvent
Dispatch an event to all subscribed listeners and return the event once it has been handled by these listeners.- Type Parameters:
T- the type bounds, must be a class which extends event- Parameters:
event- the event to call- Returns:
- the called event
-
registerListener
Register aListenerfor receiving called events. Methods in this Object which wish to receive events must be annotated with theEventHandlerannotation.- Parameters:
plugin- the owning pluginlistener- the listener to register events for
-
unregisterListener
Unregister aListenerso that the events do not reach it anymore.- Parameters:
listener- the listener to unregister
-
unregisterListeners
Unregister all of a Plugin's listener.- Parameters:
plugin-
-