Package com.velocitypowered.api.plugin
Interface PluginManager
-
public interface PluginManagerManages plugins loaded on the proxy. This manager can retrievePluginContainers from plugin instances and inject arbitrary JAR files into the plugin classpath withaddToClasspath(Object, Path).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddToClasspath(Object plugin, Path path)Adds the specifiedpathto the plugin classpath.default PluginContainerensurePluginContainer(Object plugin)Ensures a plugin container exists for the givenplugin.Optional<PluginContainer>fromInstance(Object instance)Gets the plugin container from an instance.Optional<PluginContainer>getPlugin(String id)Retrieves aPluginContainerbased on its ID.Collection<PluginContainer>getPlugins()Gets aCollectionof allPluginContainers.booleanisLoaded(String id)Checks if a plugin is loaded based on its ID.
-
-
-
Method Detail
-
fromInstance
Optional<PluginContainer> fromInstance(Object instance)
Gets the plugin container from an instance.- Parameters:
instance- the instance- Returns:
- the container
-
getPlugin
Optional<PluginContainer> getPlugin(String id)
Retrieves aPluginContainerbased on its ID.- Parameters:
id- the plugin ID- Returns:
- the plugin, if available
-
getPlugins
Collection<PluginContainer> getPlugins()
Gets aCollectionof allPluginContainers.- Returns:
- the plugins
-
isLoaded
boolean isLoaded(String id)
Checks if a plugin is loaded based on its ID.- Parameters:
id- the id of the plugin- Returns:
trueif loaded
-
addToClasspath
void addToClasspath(Object plugin, Path path)
Adds the specifiedpathto the plugin classpath.- Parameters:
plugin- the pluginpath- the path to the JAR you want to inject into the classpath- Throws:
UnsupportedOperationException- if the operation is not applicable to this plugin
-
ensurePluginContainer
default PluginContainer ensurePluginContainer(Object plugin)
Ensures a plugin container exists for the givenplugin.- Parameters:
plugin- the instance to look up the container for- Returns:
- container for the plugin
-
-