PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
pocketmine\utils\StringToTParser Class Reference
+ Inheritance diagram for pocketmine\utils\StringToTParser:
+ Collaboration diagram for pocketmine\utils\StringToTParser:

Public Member Functions

 getKnownAliases ()
 
 override (string $alias, \Closure $callback)
 
 parse (string $input)
 
 register (string $alias, \Closure $callback)
 
 registerAlias (string $existing, string $alias)
 

Protected Member Functions

 reprocess (string $input)
 

Detailed Description

Handles parsing any Minecraft thing from strings. This can be used, for example, to implement a user-friendly item parser to be used by the /give command (and others). Custom aliases may be registered. Note that the aliases should be user-friendly, i.e. easily readable and writable.

@phpstan-template T

Definition at line 39 of file StringToTParser.php.

Member Function Documentation

◆ getKnownAliases()

pocketmine\utils\StringToTParser::getKnownAliases ( )
Returns
string[]|int[]

Definition at line 94 of file StringToTParser.php.

◆ override()

pocketmine\utils\StringToTParser::override ( string $alias,
\Closure $callback )

@phpstan-param \Closure(string $input) : T $callback

Definition at line 57 of file StringToTParser.php.

◆ parse()

pocketmine\utils\StringToTParser::parse ( string $input)

Tries to parse the specified string into a corresponding instance of T. @phpstan-return T|null

Reimplemented in pocketmine\entity\effect\StringToEffectParser, pocketmine\item\enchantment\StringToEnchantmentParser, and pocketmine\item\StringToItemParser.

Definition at line 80 of file StringToTParser.php.

◆ register()

pocketmine\utils\StringToTParser::register ( string $alias,
\Closure $callback )

@phpstan-param \Closure(string $input) : T $callback

Reimplemented in pocketmine\item\StringToItemParser.

Definition at line 48 of file StringToTParser.php.

◆ registerAlias()

pocketmine\utils\StringToTParser::registerAlias ( string $existing,
string $alias )

Registers a new alias for an existing known alias.

Definition at line 64 of file StringToTParser.php.

◆ reprocess()

pocketmine\utils\StringToTParser::reprocess ( string $input)
protected

Definition at line 89 of file StringToTParser.php.


The documentation for this class was generated from the following file: