Skip to content

ThreadSafeClassLoader ​

class · pocketmine\thread\ThreadSafeClassLoader · source

Extends pmmp\thread\ThreadSafe

This autoloader can be used and updated from multiple threads. Useful if classes need to be dynamically added after threads have already been started.

This is used to facilitate loading plugin classes, enabling plugins to be loaded after the server has started.

Methods ​

__construct() ​

php
public function __construct()

addPath() ​

php
public function addPath(string $namespacePrefix, string $path, bool $prepend = false) : void

appendOrPrependLookupEntry() protected ​

php
protected function appendOrPrependLookupEntry(\pmmp\thread\ThreadSafeArray $list, string $entry, bool $prepend) : void

findClass() ​

php
public function findClass(string $name) : ?string

Returns the path for the class, if any

getAndRemoveLookupEntries() protected ​

php
protected function getAndRemoveLookupEntries(\pmmp\thread\ThreadSafeArray $list) : array

loadClass() ​

php
public function loadClass(string $name) : bool

Called when there is a class to load

normalizePath() protected ​

php
protected function normalizePath(string $path) : string

register() ​

php
public function register(bool $prepend = false) : bool

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.