mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
Merge commit '799183e13e61e89cc6820ad3132a4147454017c6'
# Conflicts: # resources/vanilla # src/Server.php # src/pocketmine/entity/Entity.php # src/pocketmine/level/format/io/LevelProviderManager.php # src/pocketmine/tile/Tile.php # src/world/generator/GeneratorManager.php
This commit is contained in:
commit
f65bf76fd8
@ -34,9 +34,15 @@ use function reset;
|
|||||||
|
|
||||||
final class TileFactory{
|
final class TileFactory{
|
||||||
|
|
||||||
/** @var string[] classes that extend Tile */
|
/**
|
||||||
|
* @var string[] classes that extend Tile
|
||||||
|
* @phpstan-var array<string, class-string<Tile>>
|
||||||
|
*/
|
||||||
private static $knownTiles = [];
|
private static $knownTiles = [];
|
||||||
/** @var string[][] */
|
/**
|
||||||
|
* @var string[][]
|
||||||
|
* @phpstan-var array<class-string<Tile>, list<string>>
|
||||||
|
*/
|
||||||
private static $saveNames = [];
|
private static $saveNames = [];
|
||||||
/** @var string[] base class => overridden class */
|
/** @var string[] base class => overridden class */
|
||||||
private static $classMapping = [];
|
private static $classMapping = [];
|
||||||
@ -90,6 +96,7 @@ final class TileFactory{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string[] $saveNames
|
* @param string[] $saveNames
|
||||||
|
* @phpstan-param class-string<Tile> $className
|
||||||
*/
|
*/
|
||||||
public static function register(string $className, array $saveNames = []) : void{
|
public static function register(string $className, array $saveNames = []) : void{
|
||||||
Utils::testValidInstance($className, Tile::class);
|
Utils::testValidInstance($className, Tile::class);
|
||||||
|
@ -114,6 +114,7 @@ final class EntityFactory{
|
|||||||
* @param string $className Class that extends Entity
|
* @param string $className Class that extends Entity
|
||||||
* @param string[] $saveNames An array of save names which this entity might be saved under. Defaults to the short name of the class itself if empty.
|
* @param string[] $saveNames An array of save names which this entity might be saved under. Defaults to the short name of the class itself if empty.
|
||||||
* @param int|null $legacyMcpeSaveId
|
* @param int|null $legacyMcpeSaveId
|
||||||
|
* @phpstan-param class-string<Entity> $className
|
||||||
*
|
*
|
||||||
* NOTE: The first save name in the $saveNames array will be used when saving the entity to disk. The reflection
|
* NOTE: The first save name in the $saveNames array will be used when saving the entity to disk. The reflection
|
||||||
* name of the class will be appended to the end and only used if no other save names are specified.
|
* name of the class will be appended to the end and only used if no other save names are specified.
|
||||||
|
@ -73,7 +73,10 @@ class PluginManager{
|
|||||||
/** @var Plugin[] */
|
/** @var Plugin[] */
|
||||||
protected $enabledPlugins = [];
|
protected $enabledPlugins = [];
|
||||||
|
|
||||||
/** @var PluginLoader[] */
|
/**
|
||||||
|
* @var PluginLoader[]
|
||||||
|
* @phpstan-var array<class-string<PluginLoader>, PluginLoader>
|
||||||
|
*/
|
||||||
protected $fileAssociations = [];
|
protected $fileAssociations = [];
|
||||||
|
|
||||||
/** @var string|null */
|
/** @var string|null */
|
||||||
@ -176,6 +179,7 @@ class PluginManager{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string[]|null $newLoaders
|
* @param string[]|null $newLoaders
|
||||||
|
* @phpstan-param list<class-string<PluginLoader>> $newLoaders
|
||||||
*
|
*
|
||||||
* @return Plugin[]
|
* @return Plugin[]
|
||||||
*/
|
*/
|
||||||
|
@ -235,6 +235,7 @@ class WorldManager{
|
|||||||
* Generates a new world if it does not exist
|
* Generates a new world if it does not exist
|
||||||
*
|
*
|
||||||
* @param string $generator Class name that extends pocketmine\world\generator\Generator
|
* @param string $generator Class name that extends pocketmine\world\generator\Generator
|
||||||
|
* @phpstan-param class-string<Generator> $generator
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -68,6 +68,9 @@ abstract class WorldProviderManager{
|
|||||||
self::$default = $class;
|
self::$default = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phpstan-param class-string<WorldProvider> $class
|
||||||
|
*/
|
||||||
public static function addProvider(string $class, string $name, bool $overwrite = false) : void{
|
public static function addProvider(string $class, string $name, bool $overwrite = false) : void{
|
||||||
Utils::testValidInstance($class, WorldProvider::class);
|
Utils::testValidInstance($class, WorldProvider::class);
|
||||||
|
|
||||||
@ -105,6 +108,8 @@ abstract class WorldProviderManager{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a WorldProvider by name, or null if not found
|
* Returns a WorldProvider by name, or null if not found
|
||||||
|
*
|
||||||
|
* @phpstan-return class-string<WorldProvider>|null
|
||||||
*/
|
*/
|
||||||
public static function getProviderByName(string $name) : ?string{
|
public static function getProviderByName(string $name) : ?string{
|
||||||
return self::$providers[trim(strtolower($name))] ?? null;
|
return self::$providers[trim(strtolower($name))] ?? null;
|
||||||
|
@ -51,6 +51,7 @@ final class GeneratorManager{
|
|||||||
* @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator
|
* @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator
|
||||||
* @param string $name Alias for this generator type that can be written in configs
|
* @param string $name Alias for this generator type that can be written in configs
|
||||||
* @param bool $overwrite Whether to force overwriting any existing registered generator with the same name
|
* @param bool $overwrite Whether to force overwriting any existing registered generator with the same name
|
||||||
|
* @phpstan-param class-string<Generator> $class
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -78,7 +79,9 @@ final class GeneratorManager{
|
|||||||
*
|
*
|
||||||
* @param bool $throwOnMissing @deprecated this is for backwards compatibility only
|
* @param bool $throwOnMissing @deprecated this is for backwards compatibility only
|
||||||
*
|
*
|
||||||
* @return string|Generator Name of class that extends Generator (not an actual Generator object)
|
* @return string Name of class that extends Generator
|
||||||
|
* @phpstan-return class-string<Generator>
|
||||||
|
*
|
||||||
* @throws \InvalidArgumentException if the generator type isn't registered
|
* @throws \InvalidArgumentException if the generator type isn't registered
|
||||||
*/
|
*/
|
||||||
public static function getGenerator(string $name, bool $throwOnMissing = false){
|
public static function getGenerator(string $name, bool $throwOnMissing = false){
|
||||||
@ -96,6 +99,7 @@ final class GeneratorManager{
|
|||||||
* Returns the registered name of the given Generator class.
|
* Returns the registered name of the given Generator class.
|
||||||
*
|
*
|
||||||
* @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator
|
* @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator
|
||||||
|
* @phpstan-param class-string<Generator> $class
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException if the class type cannot be matched to a known alias
|
* @throws \InvalidArgumentException if the class type cannot be matched to a known alias
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user