Skip to content

SelectorContext 5.46.0 ​

final class · pocketmine\command\selector\SelectorContext · source

What a target selector is evaluated against: the executing entity (@s), the origin used for distances and relative coordinates, and where to look for players and entities.

Methods ​

__construct() ​

php
public function __construct(?\pocketmine\entity\Entity $executor, ?\pocketmine\world\World $world, \pocketmine\math\Vector3 $origin, float $yaw, float $pitch, \Closure $players, \Closure $worlds, \pocketmine\player\GameMode $defaultGameMode)

fromSender() ​

php
public static function fromSender(\pocketmine\command\CommandSender $sender) : self

Context of a command sender: an entity sender (a player) is the executor and the origin; any other sender (the console, RCON...) uses the default world's spawn, like a Bedrock command block-less server console.

getDefaultGameMode() ​

php
public function getDefaultGameMode() : \pocketmine\player\GameMode

Game mode matched by m=default / m=d / m=5.

getExecutor() ​

php
public function getExecutor() : ?\pocketmine\entity\Entity

The entity running the command (@s), or null for the console and other non-entity senders.

getOrigin() ​

php
public function getOrigin() : \pocketmine\math\Vector3

getPitch() ​

php
public function getPitch() : float

getPlayers() ​

php
public function getPlayers() : array

getWorld() ​

php
public function getWorld() : ?\pocketmine\world\World

World of the origin (null if the server has no default world).

getWorlds() ​

php
public function getWorlds() : array

getYaw() ​

php
public function getYaw() : float

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