Package com.velocitypowered.api.plugin
Interface PluginManager
public interface PluginManager
Manages plugins loaded on the proxy. This manager can retrieve
PluginContainer
s from
plugin instances and inject arbitrary JAR files into the plugin classpath with addToClasspath(Object, Path)
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToClasspath
(Object plugin, Path path) Adds the specifiedpath
to the plugin classpath.default PluginContainer
ensurePluginContainer
(Object plugin) Ensures a plugin container exists for the givenplugin
.fromInstance
(Object instance) Gets the plugin container from an instance.Retrieves aPluginContainer
based on its ID.Gets aCollection
of allPluginContainer
s.boolean
Checks if a plugin is loaded based on its ID.
-
Method Details
-
fromInstance
Gets the plugin container from an instance.- Parameters:
instance
- the instance- Returns:
- the container
-
getPlugin
Retrieves aPluginContainer
based on its ID.- Parameters:
id
- the plugin ID- Returns:
- the plugin, if available
-
getPlugins
Collection<PluginContainer> getPlugins()Gets aCollection
of allPluginContainer
s.- Returns:
- the plugins
-
isLoaded
Checks if a plugin is loaded based on its ID.- Parameters:
id
- the id of the plugin- Returns:
true
if loaded
-
addToClasspath
Adds the specifiedpath
to 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
Ensures a plugin container exists for the givenplugin
.- Parameters:
plugin
- the instance to look up the container for- Returns:
- container for the plugin
-