Skip to content

CommandEvent ​

class · pocketmine\event\server\CommandEvent · source

Extends ServerEvent
Implements Cancellable

Called when any CommandSender runs a command, before it is parsed.

This can be used for logging commands, or preprocessing the command string to add custom features (e.g. selectors).

WARNING: DO NOT use this to block commands. Many commands have aliases. For example, /version can also be invoked using /ver or /about. To prevent command senders from using certain commands, deny them permission to use the commands you don't want them to have access to.

The message DOES NOT begin with a slash.

Properties ​

$command ​

php
public string $command

$sender ​

php
public \pocketmine\command\CommandSender $sender

Methods ​

__construct() ​

php
public function __construct(\pocketmine\command\CommandSender $sender, string $command)

getCommand() ​

php
public function getCommand() : string

getSender() ​

php
public function getSender() : \pocketmine\command\CommandSender

setCommand() ​

php
public function setCommand(string $command) : void

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