Package net.md_5.bungee.api.plugin
Class PluginManager
- java.lang.Object
- 
- net.md_5.bungee.api.plugin.PluginManager
 
- 
 public final class PluginManager extends Object Class to manage bridging between plugin duties and implementation duties, for example event handling and plugin management.
- 
- 
Constructor SummaryConstructors Constructor Description PluginManager(ProxyServer proxy)PluginManager(ProxyServer proxy, org.yaml.snakeyaml.Yaml yaml, EventBus eventBus, net.md_5.bungee.api.plugin.LibraryLoader libraryLoader)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <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)booleandispatchCommand(CommandSender sender, String commandLine, List<String> tabResults)Execute a command if it is registered, else return false.voidenablePlugins()Collection<Map.Entry<String,Command>>getCommands()Get an unmodifiable collection of all registered commands.PlugingetPlugin(String name)Returns a loaded plugin identified by the specified name.Collection<Plugin>getPlugins()Returns thePluginobjects corresponding to all loaded plugins.booleanisExecutableCommand(String commandName, CommandSender sender)Checks if the command is registered and can possibly be executed by the sender (without taking permissions into account).voidloadPlugins()voidregisterCommand(Plugin plugin, Command command)Register a command so that it may be executed.voidregisterListener(Plugin plugin, Listener listener)Register aListenerfor receiving called events.List<String>tabCompleteCommand(CommandSender sender, String commandLine)Searches for tab-complete suggestions for the given command line.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 Detail- 
PluginManagerpublic PluginManager(ProxyServer proxy) 
 - 
PluginManagerpublic PluginManager(ProxyServer proxy, org.yaml.snakeyaml.Yaml yaml, EventBus eventBus, net.md_5.bungee.api.plugin.LibraryLoader libraryLoader) 
 
- 
 - 
Method Detail- 
registerCommandpublic void registerCommand(Plugin plugin, Command command) Register a command so that it may be executed.- Parameters:
- plugin- the plugin owning this command
- command- the command to register
 
 - 
unregisterCommandpublic void unregisterCommand(Command command) Unregister a command so it will no longer be executed.- Parameters:
- command- the command to unregister
 
 - 
unregisterCommandspublic void unregisterCommands(Plugin plugin) Unregister all commands owned by aPlugin- Parameters:
- plugin- the plugin to register the commands of
 
 - 
isExecutableCommandpublic boolean isExecutableCommand(String commandName, CommandSender sender) Checks if the command is registered and can possibly be executed by the sender (without taking permissions into account).- Parameters:
- commandName- the name of the command
- sender- the sender executing the command
- Returns:
- whether the command will be handled
 
 - 
dispatchCommandpublic boolean dispatchCommand(CommandSender sender, String commandLine) 
 - 
dispatchCommandpublic boolean dispatchCommand(CommandSender sender, String commandLine, List<String> tabResults) Execute a command if it is registered, else return false.- Parameters:
- sender- the sender executing the command
- commandLine- the complete command line including command name and arguments
- tabResults- list to place tab results into. If this list is non null then the command will not be executed and tab results will be returned instead.
- Returns:
- whether the command was handled
 
 - 
tabCompleteCommandpublic List<String> tabCompleteCommand(CommandSender sender, String commandLine) Searches for tab-complete suggestions for the given command line.This is similar to dispatchCommand(CommandSender, String, List)called with a list, but it also handles completing the command names itself instead of just the arguments.- Parameters:
- sender- The command sender
- commandLine- The current command line
- Returns:
- The tab-complete suggestions
 
 - 
getPluginspublic Collection<Plugin> getPlugins() Returns thePluginobjects corresponding to all loaded plugins.- Returns:
- the set of loaded plugins
 
 - 
getPluginpublic Plugin getPlugin(String name) 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
 
 - 
loadPluginspublic void loadPlugins() 
 - 
enablePluginspublic void enablePlugins() 
 - 
detectPluginspublic void detectPlugins(File folder) Load all plugins from the specified folder.- Parameters:
- folder- the folder to search for plugins in
 
 - 
callEventpublic <T extends Event> T callEvent(T event) 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
 
 - 
registerListenerpublic void registerListener(Plugin plugin, Listener listener) Register aListenerfor receiving called events. Methods in this Object which wish to receive events must be annotated with theEventHandlerannotation.- Parameters:
- plugin- the owning plugin
- listener- the listener to register events for
 
 - 
unregisterListenerpublic void unregisterListener(Listener listener) Unregister aListenerso that the events do not reach it anymore.- Parameters:
- listener- the listener to unregister
 
 - 
unregisterListenerspublic void unregisterListeners(Plugin plugin) Unregister all of a Plugin's listener.- Parameters:
- plugin- target plugin
 
 - 
getCommandspublic Collection<Map.Entry<String,Command>> getCommands() Get an unmodifiable collection of all registered commands.- Returns:
- commands
 
 
- 
 
-