pocketmine\Server::broadcastPopup PHP 메소드

broadcastPopup() 공개 메소드

public broadcastPopup ( string $popup, Player[] | null $recipients = null ) : integer
$popup string
$recipients Player[] | null
리턴 integer
    public function broadcastPopup($popup, $recipients = null)
    {
        if (!is_array($recipients)) {
            /** @var Player[] $recipients */
            $recipients = [];
            foreach ($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $permissible) {
                if ($permissible instanceof Player and $permissible->hasPermission(self::BROADCAST_CHANNEL_USERS)) {
                    $recipients[spl_object_hash($permissible)] = $permissible;
                    // do not send messages directly, or some might be repeated
                }
            }
        }
        /** @var Player[] $recipients */
        foreach ($recipients as $recipient) {
            $recipient->sendPopup($popup);
        }
        return count($recipients);
    }
Server