CommandParameter 5.46.0
Describes one parameter of a command overload, for the commands list sent to clients. See ParameterizedCommand.
Methods
boolean()
public static function boolean(string $name, bool $optional = false) : selftrue or false (Bedrock's "Boolean" enum).
commandName()
public static function commandName(string $name, bool $optional = false) : selfThe name of a command, suggesting the commands (and aliases) the receiving player is allowed to use, like the argument of /help.
effect()
public static function effect(string $name, bool $optional = false) : selfAn effect name (Bedrock's "Effect" enum).
enchantment()
public static function enchantment(string $name, bool $optional = false) : selfAn enchantment name (Bedrock's "Enchant" enum).
enum()
public static function enum(string $name, string $enumName, array $values, bool $optional = false) : selfA keyword parameter. Enums are shared by name between all commands, so the same name must always have the same values (prefix it with the command name, e.g. "TitleAction").
float()
public static function float(string $name, bool $optional = false) : selfgameMode()
public static function gameMode(string $name, bool $optional = false) : selfA game mode name or letter (Bedrock's "GameMode" enum); numeric game modes need an int parameter.
getEnumName()
public function getEnumName() : ?stringEnum name, for CommandParameterType::ENUM and CommandParameterType::SOFT_ENUM parameters.
getEnumValues()
public function getEnumValues() : arraygetName()
public function getName() : stringgetPostfix()
public function getPostfix() : ?stringSuffix of CommandParameterType::POSTFIX parameters.
getType()
public function getType() : \pocketmine\command\parameter\CommandParameterTypeint()
public static function int(string $name, bool $optional = false) : selfisOptional()
public function isOptional() : boolitem()
public static function item(string $name, bool $optional = false) : selfAn item name, suggesting the vanilla item IDs the server supports (Bedrock's "Item" enum). Commands should parse it with \pocketmine\command\utils\CommandItemParser, which accepts every suggested value.
json()
public static function json(string $name, bool $optional = false) : selfmessage()
public static function message(string $name, bool $optional = false) : selfposition()
public static function position(string $name, bool $optional = false) : selfpostfixed()
public static function postfixed(string $name, string $postfix, bool $optional = false) : selfAn integer directly followed by a fixed suffix, e.g. postfixed("amount", "L") for Bedrock's "/xp 5L".
rawText()
public static function rawText(string $name, bool $optional = false) : selfsoftEnum()
public static function softEnum(string $name, string $enumName, array $values, bool $optional = false) : selfA word for which the client suggests the given values without rejecting others (Bedrock soft enum), e.g. names of structures or biomes. Like enums, soft enums are shared by name between all commands.
string()
public static function string(string $name, bool $optional = false) : selftarget()
public static function target(string $name, bool $optional = false) : selfvalue()
public static function value(string $name, bool $optional = false) : self