Documentation

StringToTParser
in package

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.

Tags
phpstan-template

T

Table of Contents

$callbackMap  : array<string|int, mixed>
getKnownAliases()  : array<string|int, string>|array<string|int, int>
override()  : void
parse()  : mixed
Tries to parse the specified string into an enchantment.
register()  : void
reprocess()  : string

Properties

$callbackMap

private array<string|int, mixed> $callbackMap = []
Tags
phpstan-var

array<string, \Closure(string $input) : T>

Methods

getKnownAliases()

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

override()

public override(string $alias, Closure $callback) : void
Parameters
$alias : string
$callback : Closure
Tags
phpstan-param

\Closure(string $input) : T $callback

Return values
void

parse()

Tries to parse the specified string into an enchantment.

public parse(string $input) : mixed
Parameters
$input : string
Tags
phpstan-return

T|null

Return values
mixed

register()

public register(string $alias, Closure $callback) : void
Parameters
$alias : string
$callback : Closure
Tags
phpstan-param

\Closure(string $input) : T $callback

Return values
void

reprocess()

protected reprocess(string $input) : string
Parameters
$input : string
Return values
string

Search results