From adc5aa11ac26ae0668368f05dc01e19aae605b33 Mon Sep 17 00:00:00 2001 From: Striker209MPE Date: Fri, 1 May 2015 19:33:33 +0200 Subject: [PATCH] Added Server->broadcastTip() and Server->broadcastPopup() Signed-off-by: Michael Yoo --- src/pocketmine/Server.php | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 74899a015..58f6da2b7 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1764,8 +1764,8 @@ class Server{ } /** - * @param $message - * @param Player[] $recipients + * @param $message + * @param Player[]|null $recipients * * @return int */ @@ -1780,6 +1780,40 @@ class Server{ } } + /** + * @param $tip + * @param Player[]|null $recipients + * + * @return int + */ + public function broadcastTip($tip, $recipients = null){ + if(!is_array($recipients)){ + return $this->broadcastTip($tip, $this->getOnlinePlayers()); + } + + /** @var Player[] $recipients */ + foreach($recipients as $recipient){ + $recipient->sendTip($tip); + } + } + + /** + * @param $popup + * @param Player[]|null $recipients + * + * @return int + */ + public function broadcastPopup($popup, $recipients = null){ + if(!is_array($recipients)){ + return $this->broadcastPopup($popup, $this->getOnlinePlayers()); + } + + /** @var Player[] $recipients */ + foreach($recipients as $recipient){ + $recipient->sendPopup($popup); + } + } + /** * @param string $message * @param string $permissions