PluginManager
in package
Manages all the plugins
Table of Contents
- $enabledPlugins : array<string|int, Plugin>
- $fileAssociations : array<string|int, PluginLoader>
- $plugins : array<string|int, Plugin>
- $graylist : PluginGraylist|null
- $loadPluginsGuard : bool
- $pluginDataDirectory : string|null
- $server : Server
- __construct() : mixed
- clearPlugins() : void
- disablePlugin() : void
- disablePlugins() : void
- enablePlugin() : void
- getPlugin() : Plugin|null
- getPlugins() : array<string|int, Plugin>
- isPluginEnabled() : bool
- loadPlugins() : array<string|int, Plugin>
- registerEvent() : void
- registerEvents() : void
- Registers all the events in the given Listener class
- registerInterface() : void
- tickSchedulers() : void
- checkDepsForTriage() : void
- getDataDirectory() : string
- getEventsHandledBy() : string|null
- Returns whether the given ReflectionMethod could be used as an event handler. Used to filter methods on Listeners when registering.
- internalLoadPlugin() : Plugin|null
- triagePlugins() : void
Properties
$enabledPlugins
protected
array<string|int, Plugin>
$enabledPlugins
= []
$fileAssociations
protected
array<string|int, PluginLoader>
$fileAssociations
= []
Tags
$plugins
protected
array<string|int, Plugin>
$plugins
= []
$graylist
private
PluginGraylist|null
$graylist
$loadPluginsGuard
private
bool
$loadPluginsGuard
= false
$pluginDataDirectory
private
string|null
$pluginDataDirectory
$server
private
Server
$server
Methods
__construct()
public
__construct(Server $server, string|null $pluginDataDirectory[, PluginGraylist|null $graylist = null ]) : mixed
Parameters
- $server : Server
- $pluginDataDirectory : string|null
- $graylist : PluginGraylist|null = null
Return values
mixed —clearPlugins()
public
clearPlugins() : void
Return values
void —disablePlugin()
public
disablePlugin(Plugin $plugin) : void
Parameters
- $plugin : Plugin
Return values
void —disablePlugins()
public
disablePlugins() : void
Return values
void —enablePlugin()
public
enablePlugin(Plugin $plugin) : void
Parameters
- $plugin : Plugin
Return values
void —getPlugin()
public
getPlugin(string $name) : Plugin|null
Parameters
- $name : string
Return values
Plugin|null —getPlugins()
public
getPlugins() : array<string|int, Plugin>
Return values
array<string|int, Plugin> —isPluginEnabled()
public
isPluginEnabled(Plugin $plugin) : bool
Parameters
- $plugin : Plugin
Return values
bool —loadPlugins()
public
loadPlugins(string $path) : array<string|int, Plugin>
Parameters
- $path : string
Return values
array<string|int, Plugin> —registerEvent()
public
registerEvent(string $event, Closure $handler, int $priority, Plugin $plugin[, bool $handleCancelled = false ]) : void
Parameters
- $event : string
-
Class name that extends Event
- $handler : Closure
- $priority : int
- $plugin : Plugin
- $handleCancelled : bool = false
Tags
Return values
void —registerEvents()
Registers all the events in the given Listener class
public
registerEvents(Listener $listener, Plugin $plugin) : void
Parameters
Tags
Return values
void —registerInterface()
public
registerInterface(PluginLoader $loader) : void
Parameters
- $loader : PluginLoader
Return values
void —tickSchedulers()
public
tickSchedulers(int $currentTick) : void
Parameters
- $currentTick : int
Return values
void —checkDepsForTriage()
private
checkDepsForTriage(string $pluginName, string $dependencyType, array<string|int, array<string|int, string>> &$dependencyLists, array<string|int, Plugin> $loadedPlugins, PluginLoadTriage $triage) : void
Parameters
- $pluginName : string
- $dependencyType : string
- $dependencyLists : array<string|int, array<string|int, string>>
- $loadedPlugins : array<string|int, Plugin>
- $triage : PluginLoadTriage
Return values
void —getDataDirectory()
private
getDataDirectory(string $pluginPath, string $pluginName) : string
Parameters
- $pluginPath : string
- $pluginName : string
Return values
string —getEventsHandledBy()
Returns whether the given ReflectionMethod could be used as an event handler. Used to filter methods on Listeners when registering.
private
getEventsHandledBy(ReflectionMethod $method) : string|null
Note: This DOES NOT validate the listener annotations; if this method returns false, the method will be ignored completely. Invalid annotations on candidate listener methods should result in an error, so those aren't checked here.
Parameters
- $method : ReflectionMethod
Tags
Return values
string|null —internalLoadPlugin()
private
internalLoadPlugin(string $path, PluginLoader $loader, PluginDescription $description) : Plugin|null
Parameters
- $path : string
- $loader : PluginLoader
- $description : PluginDescription
Return values
Plugin|null —triagePlugins()
private
triagePlugins(string $path, PluginLoadTriage $triage[, array<string|int, string>|null $newLoaders = null ]) : void
Parameters
- $path : string
- $triage : PluginLoadTriage
- $newLoaders : array<string|int, string>|null = null