mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Use broadcast permission to broadcast tips and popups
This commit is contained in:
parent
a0f8bc15dc
commit
76c27fc18b
@ -1790,7 +1790,14 @@ class Server{
|
|||||||
*/
|
*/
|
||||||
public function broadcastTip($tip, $recipients = null){
|
public function broadcastTip($tip, $recipients = null){
|
||||||
if(!is_array($recipients)){
|
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 */
|
/** @var Player[] $recipients */
|
||||||
@ -1809,7 +1816,14 @@ class Server{
|
|||||||
*/
|
*/
|
||||||
public function broadcastPopup($popup, $recipients = null){
|
public function broadcastPopup($popup, $recipients = null){
|
||||||
if(!is_array($recipients)){
|
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 */
|
/** @var Player[] $recipients */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user