Skip to content

CommandParameter 5.46.0 ​

final class · pocketmine\command\parameter\CommandParameter · source

Describes one parameter of a command overload, for the commands list sent to clients. See ParameterizedCommand.

Methods ​

boolean() ​

php
public static function boolean(string $name, bool $optional = false) : self

true or false (Bedrock's "Boolean" enum).

commandName() ​

php
public static function commandName(string $name, bool $optional = false) : self

The name of a command, suggesting the commands (and aliases) the receiving player is allowed to use, like the argument of /help.

effect() ​

php
public static function effect(string $name, bool $optional = false) : self

An effect name (Bedrock's "Effect" enum).

enchantment() ​

php
public static function enchantment(string $name, bool $optional = false) : self

An enchantment name (Bedrock's "Enchant" enum).

enum() ​

php
public static function enum(string $name, string $enumName, array $values, bool $optional = false) : self

A 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() ​

php
public static function float(string $name, bool $optional = false) : self

gameMode() ​

php
public static function gameMode(string $name, bool $optional = false) : self

A game mode name or letter (Bedrock's "GameMode" enum); numeric game modes need an int parameter.

getEnumName() ​

php
public function getEnumName() : ?string

Enum name, for CommandParameterType::ENUM and CommandParameterType::SOFT_ENUM parameters.

getEnumValues() ​

php
public function getEnumValues() : array

getName() ​

php
public function getName() : string

getPostfix() ​

php
public function getPostfix() : ?string

Suffix of CommandParameterType::POSTFIX parameters.

getType() ​

php
public function getType() : \pocketmine\command\parameter\CommandParameterType

int() ​

php
public static function int(string $name, bool $optional = false) : self

isOptional() ​

php
public function isOptional() : bool

item() ​

php
public static function item(string $name, bool $optional = false) : self

An 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() ​

php
public static function json(string $name, bool $optional = false) : self

message() ​

php
public static function message(string $name, bool $optional = false) : self

position() ​

php
public static function position(string $name, bool $optional = false) : self

postfixed() ​

php
public static function postfixed(string $name, string $postfix, bool $optional = false) : self

An integer directly followed by a fixed suffix, e.g. postfixed("amount", "L") for Bedrock's "/xp 5L".

rawText() ​

php
public static function rawText(string $name, bool $optional = false) : self

softEnum() ​

php
public static function softEnum(string $name, string $enumName, array $values, bool $optional = false) : self

A 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() ​

php
public static function string(string $name, bool $optional = false) : self

target() ​

php
public static function target(string $name, bool $optional = false) : self

value() ​

php
public static function value(string $name, bool $optional = false) : self

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.