Documentation

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

$fileAssociations

protected array<string|int, PluginLoader> $fileAssociations = []
Tags
phpstan-var

array<class-string<PluginLoader>, PluginLoader>

$pluginDataDirectory

private string|null $pluginDataDirectory

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

disablePlugins()

public disablePlugins() : void
Return values
void

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
phpstan-template

TEvent of Event

phpstan-param

class-string<TEvent> $event

phpstan-param

\Closure(TEvent) : void $handler

throws
ReflectionException
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
phpstan-return

class-string<Event>|null

Return values
string|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
Tags
phpstan-param

list<class-string<PluginLoader>> $newLoaders

Return values
void

Search results