pocketmine\event\player\PlayerChatEvent::__construct PHP Method

__construct() public method

public __construct ( Player $player, $message, $format = "chat.type.text", array $recipients = null )
$player pocketmine\Player
$recipients array
    public function __construct(Player $player, $message, $format = "chat.type.text", array $recipients = null)
    {
        $this->player = $player;
        $this->message = $message;
        //TODO: @deprecated (backwards-compativility)
        $i = 0;
        while (($pos = strpos($format, "%s")) !== false) {
            $format = substr($format, 0, $pos) . "{%{$i}}" . substr($format, $pos + 2);
            ++$i;
        }
        $this->format = $format;
        if ($recipients === null) {
            $this->recipients = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_USERS);
        } else {
            $this->recipients = $recipients;
        }
    }