Documentation

GeneratorManager
in package
Uses SingletonTrait

Table of Contents

$instance  : self|null
$list  : array<string|int, GeneratorManagerEntry>
__construct()  : mixed
addGenerator()  : void
getGenerator()  : GeneratorManagerEntry|null
Returns the generator entry of a registered Generator matching the given name, or null if not found.
getGeneratorList()  : array<string|int, string>
Returns a list of names for registered generators.
getGeneratorName()  : string
Returns the registered name of the given Generator class.
getInstance()  : self
reset()  : void
setInstance()  : void
make()  : self

Properties

Methods

addGenerator()

public addGenerator(string $class, string $name, Closure $presetValidator[, bool $overwrite = false ]) : void
Parameters
$class : string

Fully qualified name of class that extends \pocketmine\world\generator\Generator

$name : string

Alias for this generator type that can be written in configs

$presetValidator : Closure

Callback to validate generator options for new worlds

$overwrite : bool = false

Whether to force overwriting any existing registered generator with the same name

Tags
phpstan-param

\Closure(string) : ?InvalidGeneratorOptionsException $presetValidator

phpstan-param

class-string<Generator> $class

throws
InvalidArgumentException
Return values
void

getGeneratorList()

Returns a list of names for registered generators.

public getGeneratorList() : array<string|int, string>
Return values
array<string|int, string>

getGeneratorName()

Returns the registered name of the given Generator class.

public getGeneratorName(string $class) : string
Parameters
$class : string

Fully qualified name of class that extends \pocketmine\world\generator\Generator

Tags
phpstan-param

class-string<Generator> $class

throws
InvalidArgumentException

if the class type cannot be matched to a known alias

Return values
string

getInstance()

public static getInstance() : self
Return values
self

setInstance()

public static setInstance(self $instance) : void
Parameters
$instance : self
Return values
void

Search results