Use broadcast permission to broadcast tips and popups

This commit is contained in:
Michael Yoo 2015-05-23 22:04:07 +09:30
parent a0f8bc15dc
commit 76c27fc18b

View File

@ -1790,7 +1790,14 @@ class Server{
*/
public function broadcastTip($tip, $recipients = null){
if(!is_array($recipients)){
return $this->broadcastTip($tip, $this->getOnlinePlayers());
/** @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 */
@ -1809,7 +1816,14 @@ class Server{
*/
public function broadcastPopup($popup, $recipients = null){
if(!is_array($recipients)){
return $this->broadcastPopup($popup, $this->getOnlinePlayers());
/** @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 */